Skip to content

Commit bb0bdfd

Browse files
committed
Fixes:
I've enclosed two patches. The first affects Solaris compilability. The bug stems from netdb.h (where MAXHOSTNAMELEN is defined on a stock system). If the user has installed the header files from BIND 4.9.x, there will be no definition of MAXHOSTNAMELEN. The patch will, if all else fails, try to include <arpa/nameser.h> and set MAXHOSTNAMELEN to MAXDNAME, which is 256 (just like MAXHOSTNAMELEN on a stock system). The second patch adds aliases for "ISNULL" to "IS NULL" and likewise for "NOTNULL" to "IS NOT NULL". I have not removed the postgres specific ISNULL and NOTNULL. I noticed this on the TODO list, and figured it would be easy to remove. The full semantics are: [ expression IS NULL ] [ expression IS NOT NULL ] --Jason Submitted by: Jason Wright <jason@oozoo.vnet.net>
1 parent 6c684b1 commit bb0bdfd

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

src/backend/parser/gram.y

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.4 1996/08/06 16:38:03 scrappy Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.5 1996/08/06 16:43:06 scrappy Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -173,7 +173,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr);
173173
CURSOR, DATABASE, DECLARE, DELETE, DELIMITERS, DESC, DISTINCT, DO,
174174
DROP, END_TRANS,
175175
EXTEND, FETCH, FOR, FORWARD, FROM, FUNCTION, GRANT, GROUP,
176-
HAVING, HEAVY, IN, INDEX, INHERITS, INSERT, INSTEAD, INTO,
176+
HAVING, HEAVY, IN, INDEX, INHERITS, INSERT, INSTEAD, INTO, IS,
177177
ISNULL, LANGUAGE, LIGHT, LISTEN, LOAD, MERGE, MOVE, NEW,
178178
NONE, NOT, NOTHING, NOTIFY, NOTNULL,
179179
ON, OPERATOR, OPTION, OR, ORDER,
@@ -201,6 +201,7 @@ static Node *makeA_Expr(int op, char *opname, Node *lexpr, Node *rexpr);
201201
%nonassoc Op
202202
%nonassoc NOTNULL
203203
%nonassoc ISNULL
204+
%nonassoc IS
204205
%left '+' '-'
205206
%left '*' '/'
206207
%left '|' /* this is the relation union op, not logical or */
@@ -1814,8 +1815,12 @@ a_expr: attr opt_indirection
18141815
}
18151816
| a_expr ISNULL
18161817
{ $$ = makeA_Expr(ISNULL, NULL, $1, NULL); }
1818+
| a_expr IS PNULL
1819+
{ $$ = makeA_Expr(ISNULL, NULL, $1, NULL); }
18171820
| a_expr NOTNULL
18181821
{ $$ = makeA_Expr(NOTNULL, NULL, $1, NULL); }
1822+
| a_expr IS NOT PNULL
1823+
{ $$ = makeA_Expr(NOTNULL, NULL, $1, NULL); }
18191824
| a_expr AND a_expr
18201825
{ $$ = makeA_Expr(AND, NULL, $1, $3); }
18211826
| a_expr OR a_expr

src/backend/parser/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.1.1.1 1996/07/09 06:21:40 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.2 1996/08/06 16:43:08 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -87,6 +87,7 @@ static ScanKeyword ScanKeywords[] = {
8787
{ "insert", INSERT },
8888
{ "instead", INSTEAD },
8989
{ "into", INTO },
90+
{ "is", IS },
9091
{ "isnull", ISNULL },
9192
{ "language", LANGUAGE },
9293
{ "light", LIGHT },

src/backend/postmaster/postmaster.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.3 1996/07/23 02:23:47 scrappy Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.4 1996/08/06 16:43:24 scrappy Exp $
1414
*
1515
* NOTES
1616
*
@@ -49,6 +49,10 @@
4949
#define MAXINT INT_MAX
5050
#else
5151
#include <netdb.h> /* for MAXHOSTNAMELEN on some */
52+
#ifndef MAXHOSTNAMELEN /* for MAXHOSTNAMELEN everywhere else */
53+
#include <arpa/nameser.h>
54+
#define MAXHOSTNAMELEN MAXDNAME
55+
#endif
5256
# if defined(PORTNAME_BSD44_derived) || \
5357
defined(PORTNAME_bsdi) || \
5458
defined(PORTNAME_bsdi_2_1)

src/backend/tcop/postgres.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.4 1996/07/22 23:00:26 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.5 1996/08/06 16:43:41 scrappy Exp $
1111
*
1212
* NOTES
1313
* this is the "main" module of the postgres backend and
@@ -29,6 +29,10 @@
2929
#include <sys/param.h> /* for MAXHOSTNAMELEN on most */
3030
#ifndef WIN32
3131
#include <netdb.h> /* for MAXHOSTNAMELEN on some */
32+
#ifndef MAXHOSTNAMELEN /* for MAXHOSTNAMELEN everywhere else */
33+
#include <arpa/nameser.h>
34+
#define MAXHOSTNAMELEN MAXDNAME
35+
#endif
3236
#endif /* WIN32 */
3337
#include <errno.h>
3438
#ifdef PORTNAME_aix
@@ -1223,7 +1227,7 @@ PostgresMain(int argc, char *argv[])
12231227
*/
12241228
if (IsUnderPostmaster == false) {
12251229
puts("\nPOSTGRES backend interactive interface");
1226-
puts("$Revision: 1.4 $ $Date: 1996/07/22 23:00:26 $");
1230+
puts("$Revision: 1.5 $ $Date: 1996/08/06 16:43:41 $");
12271231
}
12281232

12291233
/* ----------------

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy