mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Tweak scanner/grammar interface so that the keyword-as-identifier rules
in gram.y can make use of the keywords.c string table, instead of having their own copies of the keyword strings. This saves a few kilobytes and more importantly eliminates an opportunity for cut-and-paste errors.
This commit is contained in:
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.310 2002/04/24 02:48:54 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.311 2002/05/02 18:44:10 tgl Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -107,6 +107,7 @@ static void doNegateFloat(Value *v);
|
|||||||
int ival;
|
int ival;
|
||||||
char chr;
|
char chr;
|
||||||
char *str;
|
char *str;
|
||||||
|
const char *keyword;
|
||||||
bool boolean;
|
bool boolean;
|
||||||
JoinType jtype;
|
JoinType jtype;
|
||||||
List *list;
|
List *list;
|
||||||
@ -281,10 +282,12 @@ static void doNegateFloat(Value *v);
|
|||||||
%type <str> Sconst, comment_text
|
%type <str> Sconst, comment_text
|
||||||
%type <str> UserId, opt_boolean, ColId_or_Sconst
|
%type <str> UserId, opt_boolean, ColId_or_Sconst
|
||||||
%type <list> var_list
|
%type <list> var_list
|
||||||
%type <str> ColId, ColLabel, type_name, func_name_keyword
|
%type <str> ColId, ColLabel, type_name
|
||||||
%type <str> col_name_keyword, unreserved_keyword, reserved_keyword
|
|
||||||
%type <node> var_value, zone_value
|
%type <node> var_value, zone_value
|
||||||
|
|
||||||
|
%type <keyword> unreserved_keyword, func_name_keyword
|
||||||
|
%type <keyword> col_name_keyword, reserved_keyword
|
||||||
|
|
||||||
%type <node> TableConstraint
|
%type <node> TableConstraint
|
||||||
%type <list> ColQualList
|
%type <list> ColQualList
|
||||||
%type <node> ColConstraint, ColConstraintElem, ConstraintAttr
|
%type <node> ColConstraint, ColConstraintElem, ConstraintAttr
|
||||||
@ -317,8 +320,8 @@ static void doNegateFloat(Value *v);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Keywords (in SQL92 reserved words) */
|
/* Keywords (in SQL92 reserved words) */
|
||||||
%token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC, AT, AUTHORIZATION,
|
%token <keyword> ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC, AT,
|
||||||
BEGIN_TRANS, BETWEEN, BOTH, BY,
|
AUTHORIZATION, BEGIN_TRANS, BETWEEN, BOTH, BY,
|
||||||
CASCADE, CASE, CAST, CHAR, CHARACTER, CHECK, CLOSE,
|
CASCADE, CASE, CAST, CHAR, CHARACTER, CHECK, CLOSE,
|
||||||
COALESCE, COLLATE, COLUMN, COMMIT,
|
COALESCE, COLLATE, COLUMN, COMMIT,
|
||||||
CONSTRAINT, CONSTRAINTS, CREATE, CROSS, CURRENT_DATE,
|
CONSTRAINT, CONSTRAINTS, CREATE, CROSS, CURRENT_DATE,
|
||||||
@ -343,7 +346,7 @@ static void doNegateFloat(Value *v);
|
|||||||
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE
|
WHEN, WHERE, WITH, WORK, YEAR_P, ZONE
|
||||||
|
|
||||||
/* Keywords (in SQL99 reserved words) */
|
/* Keywords (in SQL99 reserved words) */
|
||||||
%token ASSERTION, CHAIN, CHARACTERISTICS,
|
%token <keyword> ASSERTION, CHAIN, CHARACTERISTICS,
|
||||||
DEFERRABLE, DEFERRED,
|
DEFERRABLE, DEFERRED,
|
||||||
IMMEDIATE, INITIALLY, INOUT,
|
IMMEDIATE, INITIALLY, INOUT,
|
||||||
OFF, OUT,
|
OFF, OUT,
|
||||||
@ -353,7 +356,7 @@ static void doNegateFloat(Value *v);
|
|||||||
WITHOUT
|
WITHOUT
|
||||||
|
|
||||||
/* Keywords (in SQL92 non-reserved words) */
|
/* Keywords (in SQL92 non-reserved words) */
|
||||||
%token COMMITTED, SERIALIZABLE, TYPE_P, DOMAIN_P
|
%token <keyword> COMMITTED, SERIALIZABLE, TYPE_P, DOMAIN_P
|
||||||
|
|
||||||
/* Keywords for Postgres support (not in SQL92 reserved words)
|
/* Keywords for Postgres support (not in SQL92 reserved words)
|
||||||
*
|
*
|
||||||
@ -361,7 +364,7 @@ static void doNegateFloat(Value *v);
|
|||||||
* when some sort of pg_privileges relation is introduced.
|
* when some sort of pg_privileges relation is introduced.
|
||||||
* - Todd A. Brandys 1998-01-01?
|
* - Todd A. Brandys 1998-01-01?
|
||||||
*/
|
*/
|
||||||
%token ABORT_TRANS, ACCESS, AFTER, AGGREGATE, ANALYSE, ANALYZE,
|
%token <keyword> ABORT_TRANS, ACCESS, AFTER, AGGREGATE, ANALYSE, ANALYZE,
|
||||||
BACKWARD, BEFORE, BINARY, BIT,
|
BACKWARD, BEFORE, BINARY, BIT,
|
||||||
CACHE, CHECKPOINT, CLUSTER, COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE,
|
CACHE, CHECKPOINT, CLUSTER, COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE,
|
||||||
DATABASE, DELIMITERS, DO,
|
DATABASE, DELIMITERS, DO,
|
||||||
@ -2421,8 +2424,8 @@ fetch_how_many: Iconst { $$ = $1; }
|
|||||||
| PRIOR { $$ = -1; }
|
| PRIOR { $$ = -1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
from_in: IN
|
from_in: IN { }
|
||||||
| FROM
|
| FROM { }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -5963,31 +5966,31 @@ UserId: ColId { $$ = $1; };
|
|||||||
/* Column identifier --- names that can be column, table, etc names.
|
/* Column identifier --- names that can be column, table, etc names.
|
||||||
*/
|
*/
|
||||||
ColId: IDENT { $$ = $1; }
|
ColId: IDENT { $$ = $1; }
|
||||||
| unreserved_keyword { $$ = $1; }
|
| unreserved_keyword { $$ = pstrdup($1); }
|
||||||
| col_name_keyword { $$ = $1; }
|
| col_name_keyword { $$ = pstrdup($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Type identifier --- names that can be type names.
|
/* Type identifier --- names that can be type names.
|
||||||
*/
|
*/
|
||||||
type_name: IDENT { $$ = $1; }
|
type_name: IDENT { $$ = $1; }
|
||||||
| unreserved_keyword { $$ = $1; }
|
| unreserved_keyword { $$ = pstrdup($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Function identifier --- names that can be function names.
|
/* Function identifier --- names that can be function names.
|
||||||
*/
|
*/
|
||||||
function_name: IDENT { $$ = $1; }
|
function_name: IDENT { $$ = $1; }
|
||||||
| unreserved_keyword { $$ = $1; }
|
| unreserved_keyword { $$ = pstrdup($1); }
|
||||||
| func_name_keyword { $$ = $1; }
|
| func_name_keyword { $$ = pstrdup($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Column label --- allowed labels in "AS" clauses.
|
/* Column label --- allowed labels in "AS" clauses.
|
||||||
* This presently includes *all* Postgres keywords.
|
* This presently includes *all* Postgres keywords.
|
||||||
*/
|
*/
|
||||||
ColLabel: IDENT { $$ = $1; }
|
ColLabel: IDENT { $$ = $1; }
|
||||||
| unreserved_keyword { $$ = $1; }
|
| unreserved_keyword { $$ = pstrdup($1); }
|
||||||
| col_name_keyword { $$ = $1; }
|
| col_name_keyword { $$ = pstrdup($1); }
|
||||||
| func_name_keyword { $$ = $1; }
|
| func_name_keyword { $$ = pstrdup($1); }
|
||||||
| reserved_keyword { $$ = $1; }
|
| reserved_keyword { $$ = pstrdup($1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -6003,161 +6006,161 @@ ColLabel: IDENT { $$ = $1; }
|
|||||||
/* "Unreserved" keywords --- available for use as any kind of name.
|
/* "Unreserved" keywords --- available for use as any kind of name.
|
||||||
*/
|
*/
|
||||||
unreserved_keyword:
|
unreserved_keyword:
|
||||||
ABORT_TRANS { $$ = "abort"; }
|
ABORT_TRANS
|
||||||
| ABSOLUTE { $$ = "absolute"; }
|
| ABSOLUTE
|
||||||
| ACCESS { $$ = "access"; }
|
| ACCESS
|
||||||
| ACTION { $$ = "action"; }
|
| ACTION
|
||||||
| ADD { $$ = "add"; }
|
| ADD
|
||||||
| AFTER { $$ = "after"; }
|
| AFTER
|
||||||
| AGGREGATE { $$ = "aggregate"; }
|
| AGGREGATE
|
||||||
| ALTER { $$ = "alter"; }
|
| ALTER
|
||||||
| ASSERTION { $$ = "assertion"; }
|
| ASSERTION
|
||||||
| AT { $$ = "at"; }
|
| AT
|
||||||
| BACKWARD { $$ = "backward"; }
|
| BACKWARD
|
||||||
| BEFORE { $$ = "before"; }
|
| BEFORE
|
||||||
| BEGIN_TRANS { $$ = "begin"; }
|
| BEGIN_TRANS
|
||||||
| BY { $$ = "by"; }
|
| BY
|
||||||
| CACHE { $$ = "cache"; }
|
| CACHE
|
||||||
| CASCADE { $$ = "cascade"; }
|
| CASCADE
|
||||||
| CHAIN { $$ = "chain"; }
|
| CHAIN
|
||||||
| CHARACTERISTICS { $$ = "characteristics"; }
|
| CHARACTERISTICS
|
||||||
| CHECKPOINT { $$ = "checkpoint"; }
|
| CHECKPOINT
|
||||||
| CLOSE { $$ = "close"; }
|
| CLOSE
|
||||||
| CLUSTER { $$ = "cluster"; }
|
| CLUSTER
|
||||||
| COMMENT { $$ = "comment"; }
|
| COMMENT
|
||||||
| COMMIT { $$ = "commit"; }
|
| COMMIT
|
||||||
| COMMITTED { $$ = "committed"; }
|
| COMMITTED
|
||||||
| CONSTRAINTS { $$ = "constraints"; }
|
| CONSTRAINTS
|
||||||
| COPY { $$ = "copy"; }
|
| COPY
|
||||||
| CREATEDB { $$ = "createdb"; }
|
| CREATEDB
|
||||||
| CREATEUSER { $$ = "createuser"; }
|
| CREATEUSER
|
||||||
| CURSOR { $$ = "cursor"; }
|
| CURSOR
|
||||||
| CYCLE { $$ = "cycle"; }
|
| CYCLE
|
||||||
| DATABASE { $$ = "database"; }
|
| DATABASE
|
||||||
| DAY_P { $$ = "day"; }
|
| DAY_P
|
||||||
| DECLARE { $$ = "declare"; }
|
| DECLARE
|
||||||
| DEFERRED { $$ = "deferred"; }
|
| DEFERRED
|
||||||
| DELETE { $$ = "delete"; }
|
| DELETE
|
||||||
| DELIMITERS { $$ = "delimiters"; }
|
| DELIMITERS
|
||||||
| DOMAIN_P { $$ = "domain"; }
|
| DOMAIN_P
|
||||||
| DOUBLE { $$ = "double"; }
|
| DOUBLE
|
||||||
| DROP { $$ = "drop"; }
|
| DROP
|
||||||
| EACH { $$ = "each"; }
|
| EACH
|
||||||
| ENCODING { $$ = "encoding"; }
|
| ENCODING
|
||||||
| ENCRYPTED { $$ = "encrypted"; }
|
| ENCRYPTED
|
||||||
| ESCAPE { $$ = "escape"; }
|
| ESCAPE
|
||||||
| EXCLUSIVE { $$ = "exclusive"; }
|
| EXCLUSIVE
|
||||||
| EXECUTE { $$ = "execute"; }
|
| EXECUTE
|
||||||
| EXPLAIN { $$ = "explain"; }
|
| EXPLAIN
|
||||||
| FETCH { $$ = "fetch"; }
|
| FETCH
|
||||||
| FORCE { $$ = "force"; }
|
| FORCE
|
||||||
| FORWARD { $$ = "forward"; }
|
| FORWARD
|
||||||
| FUNCTION { $$ = "function"; }
|
| FUNCTION
|
||||||
| GLOBAL { $$ = "global"; }
|
| GLOBAL
|
||||||
| HANDLER { $$ = "handler"; }
|
| HANDLER
|
||||||
| HOUR_P { $$ = "hour"; }
|
| HOUR_P
|
||||||
| IMMEDIATE { $$ = "immediate"; }
|
| IMMEDIATE
|
||||||
| INCREMENT { $$ = "increment"; }
|
| INCREMENT
|
||||||
| INDEX { $$ = "index"; }
|
| INDEX
|
||||||
| INHERITS { $$ = "inherits"; }
|
| INHERITS
|
||||||
| INOUT { $$ = "inout"; }
|
| INOUT
|
||||||
| INSENSITIVE { $$ = "insensitive"; }
|
| INSENSITIVE
|
||||||
| INSERT { $$ = "insert"; }
|
| INSERT
|
||||||
| INSTEAD { $$ = "instead"; }
|
| INSTEAD
|
||||||
| ISOLATION { $$ = "isolation"; }
|
| ISOLATION
|
||||||
| KEY { $$ = "key"; }
|
| KEY
|
||||||
| LANGUAGE { $$ = "language"; }
|
| LANGUAGE
|
||||||
| LANCOMPILER { $$ = "lancompiler"; }
|
| LANCOMPILER
|
||||||
| LEVEL { $$ = "level"; }
|
| LEVEL
|
||||||
| LISTEN { $$ = "listen"; }
|
| LISTEN
|
||||||
| LOAD { $$ = "load"; }
|
| LOAD
|
||||||
| LOCAL { $$ = "local"; }
|
| LOCAL
|
||||||
| LOCATION { $$ = "location"; }
|
| LOCATION
|
||||||
| LOCK_P { $$ = "lock"; }
|
| LOCK_P
|
||||||
| MATCH { $$ = "match"; }
|
| MATCH
|
||||||
| MAXVALUE { $$ = "maxvalue"; }
|
| MAXVALUE
|
||||||
| MINUTE_P { $$ = "minute"; }
|
| MINUTE_P
|
||||||
| MINVALUE { $$ = "minvalue"; }
|
| MINVALUE
|
||||||
| MODE { $$ = "mode"; }
|
| MODE
|
||||||
| MONTH_P { $$ = "month"; }
|
| MONTH_P
|
||||||
| MOVE { $$ = "move"; }
|
| MOVE
|
||||||
| NAMES { $$ = "names"; }
|
| NAMES
|
||||||
| NATIONAL { $$ = "national"; }
|
| NATIONAL
|
||||||
| NEXT { $$ = "next"; }
|
| NEXT
|
||||||
| NO { $$ = "no"; }
|
| NO
|
||||||
| NOCREATEDB { $$ = "nocreatedb"; }
|
| NOCREATEDB
|
||||||
| NOCREATEUSER { $$ = "nocreateuser"; }
|
| NOCREATEUSER
|
||||||
| NOTHING { $$ = "nothing"; }
|
| NOTHING
|
||||||
| NOTIFY { $$ = "notify"; }
|
| NOTIFY
|
||||||
| OF { $$ = "of"; }
|
| OF
|
||||||
| OIDS { $$ = "oids"; }
|
| OIDS
|
||||||
| OPERATOR { $$ = "operator"; }
|
| OPERATOR
|
||||||
| OPTION { $$ = "option"; }
|
| OPTION
|
||||||
| OUT { $$ = "out"; }
|
| OUT
|
||||||
| OWNER { $$ = "owner"; }
|
| OWNER
|
||||||
| PARTIAL { $$ = "partial"; }
|
| PARTIAL
|
||||||
| PASSWORD { $$ = "password"; }
|
| PASSWORD
|
||||||
| PATH_P { $$ = "path"; }
|
| PATH_P
|
||||||
| PENDANT { $$ = "pendant"; }
|
| PENDANT
|
||||||
| PRECISION { $$ = "precision"; }
|
| PRECISION
|
||||||
| PRIOR { $$ = "prior"; }
|
| PRIOR
|
||||||
| PRIVILEGES { $$ = "privileges"; }
|
| PRIVILEGES
|
||||||
| PROCEDURAL { $$ = "procedural"; }
|
| PROCEDURAL
|
||||||
| PROCEDURE { $$ = "procedure"; }
|
| PROCEDURE
|
||||||
| READ { $$ = "read"; }
|
| READ
|
||||||
| REINDEX { $$ = "reindex"; }
|
| REINDEX
|
||||||
| RELATIVE { $$ = "relative"; }
|
| RELATIVE
|
||||||
| RENAME { $$ = "rename"; }
|
| RENAME
|
||||||
| REPLACE { $$ = "replace"; }
|
| REPLACE
|
||||||
| RESET { $$ = "reset"; }
|
| RESET
|
||||||
| RESTRICT { $$ = "restrict"; }
|
| RESTRICT
|
||||||
| RETURNS { $$ = "returns"; }
|
| RETURNS
|
||||||
| REVOKE { $$ = "revoke"; }
|
| REVOKE
|
||||||
| ROLLBACK { $$ = "rollback"; }
|
| ROLLBACK
|
||||||
| ROW { $$ = "row"; }
|
| ROW
|
||||||
| RULE { $$ = "rule"; }
|
| RULE
|
||||||
| SCHEMA { $$ = "schema"; }
|
| SCHEMA
|
||||||
| SCROLL { $$ = "scroll"; }
|
| SCROLL
|
||||||
| SECOND_P { $$ = "second"; }
|
| SECOND_P
|
||||||
| SESSION { $$ = "session"; }
|
| SESSION
|
||||||
| SEQUENCE { $$ = "sequence"; }
|
| SEQUENCE
|
||||||
| SERIALIZABLE { $$ = "serializable"; }
|
| SERIALIZABLE
|
||||||
| SET { $$ = "set"; }
|
| SET
|
||||||
| SHARE { $$ = "share"; }
|
| SHARE
|
||||||
| SHOW { $$ = "show"; }
|
| SHOW
|
||||||
| START { $$ = "start"; }
|
| START
|
||||||
| STATEMENT { $$ = "statement"; }
|
| STATEMENT
|
||||||
| STATISTICS { $$ = "statistics"; }
|
| STATISTICS
|
||||||
| STDIN { $$ = "stdin"; }
|
| STDIN
|
||||||
| STDOUT { $$ = "stdout"; }
|
| STDOUT
|
||||||
| STORAGE { $$ = "storage"; }
|
| STORAGE
|
||||||
| SYSID { $$ = "sysid"; }
|
| SYSID
|
||||||
| TEMP { $$ = "temp"; }
|
| TEMP
|
||||||
| TEMPLATE { $$ = "template"; }
|
| TEMPLATE
|
||||||
| TEMPORARY { $$ = "temporary"; }
|
| TEMPORARY
|
||||||
| TOAST { $$ = "toast"; }
|
| TOAST
|
||||||
| TRANSACTION { $$ = "transaction"; }
|
| TRANSACTION
|
||||||
| TRIGGER { $$ = "trigger"; }
|
| TRIGGER
|
||||||
| TRUNCATE { $$ = "truncate"; }
|
| TRUNCATE
|
||||||
| TRUSTED { $$ = "trusted"; }
|
| TRUSTED
|
||||||
| TYPE_P { $$ = "type"; }
|
| TYPE_P
|
||||||
| UNENCRYPTED { $$ = "unencrypted"; }
|
| UNENCRYPTED
|
||||||
| UNKNOWN { $$ = "unknown"; }
|
| UNKNOWN
|
||||||
| UNLISTEN { $$ = "unlisten"; }
|
| UNLISTEN
|
||||||
| UNTIL { $$ = "until"; }
|
| UNTIL
|
||||||
| UPDATE { $$ = "update"; }
|
| UPDATE
|
||||||
| USAGE { $$ = "usage"; }
|
| USAGE
|
||||||
| VACUUM { $$ = "vacuum"; }
|
| VACUUM
|
||||||
| VALID { $$ = "valid"; }
|
| VALID
|
||||||
| VALUES { $$ = "values"; }
|
| VALUES
|
||||||
| VARYING { $$ = "varying"; }
|
| VARYING
|
||||||
| VERSION { $$ = "version"; }
|
| VERSION
|
||||||
| VIEW { $$ = "view"; }
|
| VIEW
|
||||||
| WITH { $$ = "with"; }
|
| WITH
|
||||||
| WITHOUT { $$ = "without"; }
|
| WITHOUT
|
||||||
| WORK { $$ = "work"; }
|
| WORK
|
||||||
| YEAR_P { $$ = "year"; }
|
| YEAR_P
|
||||||
| ZONE { $$ = "zone"; }
|
| ZONE
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Column identifier --- keywords that can be column, table, etc names.
|
/* Column identifier --- keywords that can be column, table, etc names.
|
||||||
@ -6171,27 +6174,27 @@ unreserved_keyword:
|
|||||||
* looks too much like a function call for an LR(1) parser.
|
* looks too much like a function call for an LR(1) parser.
|
||||||
*/
|
*/
|
||||||
col_name_keyword:
|
col_name_keyword:
|
||||||
BIT { $$ = "bit"; }
|
BIT
|
||||||
| CHAR { $$ = "char"; }
|
| CHAR
|
||||||
| CHARACTER { $$ = "character"; }
|
| CHARACTER
|
||||||
| COALESCE { $$ = "coalesce"; }
|
| COALESCE
|
||||||
| DEC { $$ = "dec"; }
|
| DEC
|
||||||
| DECIMAL { $$ = "decimal"; }
|
| DECIMAL
|
||||||
| EXISTS { $$ = "exists"; }
|
| EXISTS
|
||||||
| EXTRACT { $$ = "extract"; }
|
| EXTRACT
|
||||||
| FLOAT { $$ = "float"; }
|
| FLOAT
|
||||||
| INTERVAL { $$ = "interval"; }
|
| INTERVAL
|
||||||
| NCHAR { $$ = "nchar"; }
|
| NCHAR
|
||||||
| NONE { $$ = "none"; }
|
| NONE
|
||||||
| NULLIF { $$ = "nullif"; }
|
| NULLIF
|
||||||
| NUMERIC { $$ = "numeric"; }
|
| NUMERIC
|
||||||
| POSITION { $$ = "position"; }
|
| POSITION
|
||||||
| SETOF { $$ = "setof"; }
|
| SETOF
|
||||||
| SUBSTRING { $$ = "substring"; }
|
| SUBSTRING
|
||||||
| TIME { $$ = "time"; }
|
| TIME
|
||||||
| TIMESTAMP { $$ = "timestamp"; }
|
| TIMESTAMP
|
||||||
| TRIM { $$ = "trim"; }
|
| TRIM
|
||||||
| VARCHAR { $$ = "varchar"; }
|
| VARCHAR
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Function identifier --- keywords that can be function names.
|
/* Function identifier --- keywords that can be function names.
|
||||||
@ -6205,26 +6208,26 @@ col_name_keyword:
|
|||||||
* - thomas 2000-11-28
|
* - thomas 2000-11-28
|
||||||
*/
|
*/
|
||||||
func_name_keyword:
|
func_name_keyword:
|
||||||
AUTHORIZATION { $$ = "authorization"; }
|
AUTHORIZATION
|
||||||
| BETWEEN { $$ = "between"; }
|
| BETWEEN
|
||||||
| BINARY { $$ = "binary"; }
|
| BINARY
|
||||||
| CROSS { $$ = "cross"; }
|
| CROSS
|
||||||
| FREEZE { $$ = "freeze"; }
|
| FREEZE
|
||||||
| FULL { $$ = "full"; }
|
| FULL
|
||||||
| ILIKE { $$ = "ilike"; }
|
| ILIKE
|
||||||
| IN { $$ = "in"; }
|
| IN
|
||||||
| INNER_P { $$ = "inner"; }
|
| INNER_P
|
||||||
| IS { $$ = "is"; }
|
| IS
|
||||||
| ISNULL { $$ = "isnull"; }
|
| ISNULL
|
||||||
| JOIN { $$ = "join"; }
|
| JOIN
|
||||||
| LEFT { $$ = "left"; }
|
| LEFT
|
||||||
| LIKE { $$ = "like"; }
|
| LIKE
|
||||||
| NATURAL { $$ = "natural"; }
|
| NATURAL
|
||||||
| NOTNULL { $$ = "notnull"; }
|
| NOTNULL
|
||||||
| OUTER_P { $$ = "outer"; }
|
| OUTER_P
|
||||||
| OVERLAPS { $$ = "overlaps"; }
|
| OVERLAPS
|
||||||
| RIGHT { $$ = "right"; }
|
| RIGHT
|
||||||
| VERBOSE { $$ = "verbose"; }
|
| VERBOSE
|
||||||
;
|
;
|
||||||
|
|
||||||
/* Reserved keyword --- these keywords are usable only as a ColLabel.
|
/* Reserved keyword --- these keywords are usable only as a ColLabel.
|
||||||
@ -6234,71 +6237,71 @@ func_name_keyword:
|
|||||||
* forced to.
|
* forced to.
|
||||||
*/
|
*/
|
||||||
reserved_keyword:
|
reserved_keyword:
|
||||||
ALL { $$ = "all"; }
|
ALL
|
||||||
| ANALYSE { $$ = "analyse"; } /* British */
|
| ANALYSE
|
||||||
| ANALYZE { $$ = "analyze"; }
|
| ANALYZE
|
||||||
| AND { $$ = "and"; }
|
| AND
|
||||||
| ANY { $$ = "any"; }
|
| ANY
|
||||||
| AS { $$ = "as"; }
|
| AS
|
||||||
| ASC { $$ = "asc"; }
|
| ASC
|
||||||
| BOTH { $$ = "both"; }
|
| BOTH
|
||||||
| CASE { $$ = "case"; }
|
| CASE
|
||||||
| CAST { $$ = "cast"; }
|
| CAST
|
||||||
| CHECK { $$ = "check"; }
|
| CHECK
|
||||||
| COLLATE { $$ = "collate"; }
|
| COLLATE
|
||||||
| COLUMN { $$ = "column"; }
|
| COLUMN
|
||||||
| CONSTRAINT { $$ = "constraint"; }
|
| CONSTRAINT
|
||||||
| CREATE { $$ = "create"; }
|
| CREATE
|
||||||
| CURRENT_DATE { $$ = "current_date"; }
|
| CURRENT_DATE
|
||||||
| CURRENT_TIME { $$ = "current_time"; }
|
| CURRENT_TIME
|
||||||
| CURRENT_TIMESTAMP { $$ = "current_timestamp"; }
|
| CURRENT_TIMESTAMP
|
||||||
| CURRENT_USER { $$ = "current_user"; }
|
| CURRENT_USER
|
||||||
| DEFAULT { $$ = "default"; }
|
| DEFAULT
|
||||||
| DEFERRABLE { $$ = "deferrable"; }
|
| DEFERRABLE
|
||||||
| DESC { $$ = "desc"; }
|
| DESC
|
||||||
| DISTINCT { $$ = "distinct"; }
|
| DISTINCT
|
||||||
| DO { $$ = "do"; }
|
| DO
|
||||||
| ELSE { $$ = "else"; }
|
| ELSE
|
||||||
| END_TRANS { $$ = "end"; }
|
| END_TRANS
|
||||||
| EXCEPT { $$ = "except"; }
|
| EXCEPT
|
||||||
| FALSE_P { $$ = "false"; }
|
| FALSE_P
|
||||||
| FOR { $$ = "for"; }
|
| FOR
|
||||||
| FOREIGN { $$ = "foreign"; }
|
| FOREIGN
|
||||||
| FROM { $$ = "from"; }
|
| FROM
|
||||||
| GRANT { $$ = "grant"; }
|
| GRANT
|
||||||
| GROUP { $$ = "group"; }
|
| GROUP
|
||||||
| HAVING { $$ = "having"; }
|
| HAVING
|
||||||
| INITIALLY { $$ = "initially"; }
|
| INITIALLY
|
||||||
| INTERSECT { $$ = "intersect"; }
|
| INTERSECT
|
||||||
| INTO { $$ = "into"; }
|
| INTO
|
||||||
| LEADING { $$ = "leading"; }
|
| LEADING
|
||||||
| LIMIT { $$ = "limit"; }
|
| LIMIT
|
||||||
| NEW { $$ = "new"; }
|
| NEW
|
||||||
| NOT { $$ = "not"; }
|
| NOT
|
||||||
| NULL_P { $$ = "null"; }
|
| NULL_P
|
||||||
| OFF { $$ = "off"; }
|
| OFF
|
||||||
| OFFSET { $$ = "offset"; }
|
| OFFSET
|
||||||
| OLD { $$ = "old"; }
|
| OLD
|
||||||
| ON { $$ = "on"; }
|
| ON
|
||||||
| ONLY { $$ = "only"; }
|
| ONLY
|
||||||
| OR { $$ = "or"; }
|
| OR
|
||||||
| ORDER { $$ = "order"; }
|
| ORDER
|
||||||
| PRIMARY { $$ = "primary"; }
|
| PRIMARY
|
||||||
| REFERENCES { $$ = "references"; }
|
| REFERENCES
|
||||||
| SELECT { $$ = "select"; }
|
| SELECT
|
||||||
| SESSION_USER { $$ = "session_user"; }
|
| SESSION_USER
|
||||||
| SOME { $$ = "some"; }
|
| SOME
|
||||||
| TABLE { $$ = "table"; }
|
| TABLE
|
||||||
| THEN { $$ = "then"; }
|
| THEN
|
||||||
| TO { $$ = "to"; }
|
| TO
|
||||||
| TRAILING { $$ = "trailing"; }
|
| TRAILING
|
||||||
| TRUE_P { $$ = "true"; }
|
| TRUE_P
|
||||||
| UNION { $$ = "union"; }
|
| UNION
|
||||||
| UNIQUE { $$ = "unique"; }
|
| UNIQUE
|
||||||
| USER { $$ = "user"; }
|
| USER
|
||||||
| USING { $$ = "using"; }
|
| USING
|
||||||
| WHEN { $$ = "when"; }
|
| WHEN
|
||||||
| WHERE { $$ = "where"; }
|
| WHERE
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.107 2002/04/21 19:21:49 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.108 2002/05/02 18:44:10 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -26,7 +26,7 @@
|
|||||||
* !!WARNING!!: This list must be sorted, because binary
|
* !!WARNING!!: This list must be sorted, because binary
|
||||||
* search is used to locate entries.
|
* search is used to locate entries.
|
||||||
*/
|
*/
|
||||||
static ScanKeyword ScanKeywords[] = {
|
static const ScanKeyword ScanKeywords[] = {
|
||||||
/* name, value */
|
/* name, value */
|
||||||
{"abort", ABORT_TRANS},
|
{"abort", ABORT_TRANS},
|
||||||
{"absolute", ABSOLUTE},
|
{"absolute", ABSOLUTE},
|
||||||
@ -303,14 +303,14 @@ static ScanKeyword ScanKeywords[] = {
|
|||||||
* keywords are to be matched in this way even though non-keyword identifiers
|
* keywords are to be matched in this way even though non-keyword identifiers
|
||||||
* receive a different case-normalization mapping.
|
* receive a different case-normalization mapping.
|
||||||
*/
|
*/
|
||||||
ScanKeyword *
|
const ScanKeyword *
|
||||||
ScanKeywordLookup(char *text)
|
ScanKeywordLookup(const char *text)
|
||||||
{
|
{
|
||||||
int len,
|
int len,
|
||||||
i;
|
i;
|
||||||
char word[NAMEDATALEN];
|
char word[NAMEDATALEN];
|
||||||
ScanKeyword *low;
|
const ScanKeyword *low;
|
||||||
ScanKeyword *high;
|
const ScanKeyword *high;
|
||||||
|
|
||||||
len = strlen(text);
|
len = strlen(text);
|
||||||
/* We assume all keywords are shorter than NAMEDATALEN. */
|
/* We assume all keywords are shorter than NAMEDATALEN. */
|
||||||
@ -342,7 +342,7 @@ ScanKeywordLookup(char *text)
|
|||||||
high = endof(ScanKeywords) - 1;
|
high = endof(ScanKeywords) - 1;
|
||||||
while (low <= high)
|
while (low <= high)
|
||||||
{
|
{
|
||||||
ScanKeyword *middle;
|
const ScanKeyword *middle;
|
||||||
int difference;
|
int difference;
|
||||||
|
|
||||||
middle = low + (high - low) / 2;
|
middle = low + (high - low) / 2;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.93 2002/05/01 17:12:07 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.94 2002/05/02 18:44:10 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -504,14 +504,17 @@ other .
|
|||||||
|
|
||||||
|
|
||||||
{identifier} {
|
{identifier} {
|
||||||
ScanKeyword *keyword;
|
const ScanKeyword *keyword;
|
||||||
char *ident;
|
char *ident;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Is it a keyword? */
|
/* Is it a keyword? */
|
||||||
keyword = ScanKeywordLookup(yytext);
|
keyword = ScanKeywordLookup(yytext);
|
||||||
if (keyword != NULL)
|
if (keyword != NULL)
|
||||||
|
{
|
||||||
|
yylval.keyword = keyword->name;
|
||||||
return keyword->value;
|
return keyword->value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No. Convert the identifier to lower case, and truncate
|
* No. Convert the identifier to lower case, and truncate
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* back to source text
|
* back to source text
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.100 2002/04/28 00:49:13 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.101 2002/05/02 18:44:11 tgl Exp $
|
||||||
*
|
*
|
||||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||||
*
|
*
|
||||||
@ -2611,7 +2611,7 @@ quote_identifier(const char *ident)
|
|||||||
* Note: ScanKeywordLookup() does case-insensitive comparison, but
|
* Note: ScanKeywordLookup() does case-insensitive comparison, but
|
||||||
* that's fine, since we already know we have all-lower-case.
|
* that's fine, since we already know we have all-lower-case.
|
||||||
*/
|
*/
|
||||||
if (ScanKeywordLookup((char *) ident) != NULL)
|
if (ScanKeywordLookup(ident) != NULL)
|
||||||
safe = false;
|
safe = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: keywords.h,v 1.14 2002/04/21 00:26:44 tgl Exp $
|
* $Id: keywords.h,v 1.15 2002/05/02 18:44:11 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
typedef struct ScanKeyword
|
typedef struct ScanKeyword
|
||||||
{
|
{
|
||||||
char *name;
|
const char *name;
|
||||||
int value;
|
int value;
|
||||||
} ScanKeyword;
|
} ScanKeyword;
|
||||||
|
|
||||||
extern ScanKeyword *ScanKeywordLookup(char *text);
|
extern const ScanKeyword *ScanKeywordLookup(const char *text);
|
||||||
|
|
||||||
#endif /* KEYWORDS_H */
|
#endif /* KEYWORDS_H */
|
||||||
|
Reference in New Issue
Block a user