Commit c683abb1 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Add as many keywords as possible to column identifier or label lists.

Add "timestamp" to list of tokens in keywords.c.
 Before, TIMESTAMP WITH TIME ZONE did not actually parser.
Reorder token lists to be more alphabetical.
Remove ARCHIVE keyword which was deprecated in v6.3.
parent 96273049
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.32 1998/09/25 13:36:01 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.33 1998/09/30 05:47:56 thomas Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -257,57 +257,52 @@ Oid param_type(int t); /* used in parse_expr.c */ ...@@ -257,57 +257,52 @@ Oid param_type(int t); /* used in parse_expr.c */
*/ */
/* Keywords (in SQL92 reserved words) */ /* Keywords (in SQL92 reserved words) */
%token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY AS, ASC, %token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC,
BEGIN_TRANS, BETWEEN, BOTH, BY, BEGIN_TRANS, BETWEEN, BOTH, BY,
CASCADE, CAST, CHAR, CHARACTER, CHECK, CLOSE, COLLATE, COLUMN, COMMIT, CASCADE, CAST, CHAR, CHARACTER, CHECK, CLOSE, COLLATE, COLUMN, COMMIT,
CONSTRAINT, CREATE, CROSS, CURRENT, CURRENT_DATE, CURRENT_TIME, CONSTRAINT, CREATE, CROSS, CURRENT, CURRENT_DATE, CURRENT_TIME,
CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR,
DAY_P, DECIMAL, DECLARE, DEFAULT, DELETE, DESC, DISTINCT, DOUBLE, DROP, DAY_P, DECIMAL, DECLARE, DEFAULT, DELETE, DESC, DISTINCT, DOUBLE, DROP,
END_TRANS, EXECUTE, EXISTS, EXTRACT, END_TRANS, EXECUTE, EXISTS, EXTRACT,
FETCH, FLOAT, FOR, FOREIGN, FROM, FULL, FALSE_P, FETCH, FLOAT, FOR, FOREIGN, FROM, FULL,
GRANT, GROUP, HAVING, HOUR_P, GRANT, GROUP, HAVING, HOUR_P,
IN, INNER_P, INSENSITIVE, INSERT, INTERVAL, INTO, IS, IN, INNER_P, INSENSITIVE, INSERT, INTERVAL, INTO, IS,
JOIN, KEY, LANGUAGE, LEADING, LEFT, LIKE, LOCAL, JOIN, KEY, LANGUAGE, LEADING, LEFT, LIKE, LOCAL,
MATCH, MINUTE_P, MONTH_P, NAMES, MATCH, MINUTE_P, MONTH_P, NAMES,
NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NOTIFY, NULL_P, NUMERIC, NATIONAL, NATURAL, NCHAR, NEXT, NO, NOT, NULL_P, NUMERIC,
OF, ON, ONLY, OPTION, OR, ORDER, OUTER_P, OF, ON, ONLY, OPTION, OR, ORDER, OUTER_P,
PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC, PARTIAL, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC,
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK, READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
SCROLL, SECOND_P, SELECT, SET, SUBSTRING, SCROLL, SECOND_P, SELECT, SET, SUBSTRING,
TABLE, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE, TABLE, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE,
TO, TRAILING, TRANSACTION, TRIM, TO, TRAILING, TRANSACTION, TRIM, TRUE_P,
UNION, UNIQUE, UPDATE, USER, USING, UNION, UNIQUE, UPDATE, USER, USING,
VALUES, VARCHAR, VARYING, VIEW, VALUES, VARCHAR, VARYING, VIEW,
WHERE, WITH, WORK, YEAR_P, ZONE WHERE, WITH, WORK, YEAR_P, ZONE
/* Keywords (in SQL3 reserved words) */ /* Keywords (in SQL3 reserved words) */
%token FALSE_P, TRIGGER, TRUE_P %token TRIGGER
/* Keywords (in SQL92 non-reserved words) */ /* Keywords (in SQL92 non-reserved words) */
%token TYPE_P %token TYPE_P
/* Keywords for Postgres support (not in SQL92 reserved words) */ /* Keywords for Postgres support (not in SQL92 reserved words)
%token ABORT_TRANS, AFTER, AGGREGATE, ANALYZE, *
BACKWARD, BEFORE, BINARY, CACHE, CLUSTER, COPY, CYCLE, * The CREATEDB and CREATEUSER tokens should go away
DATABASE, DELIMITERS, DO, EACH, EXPLAIN, EXTEND, * when some sort of pg_privileges relation is introduced.
* - Todd A. Brandys 1998-01-01?
*/
%token ABORT_TRANS, AFTER, AGGREGATE, ANALYZE, BACKWARD, BEFORE, BINARY,
CACHE, CLUSTER, COPY, CREATEDB, CREATEUSER, CYCLE,
DATABASE, DELIMITERS, DO, EACH, ENCODING, EXPLAIN, EXTEND,
FORWARD, FUNCTION, HANDLER, FORWARD, FUNCTION, HANDLER,
INCREMENT, INDEX, INHERITS, INSTEAD, ISNULL, INCREMENT, INDEX, INHERITS, INSTEAD, ISNULL,
LANCOMPILER, LISTEN, LOAD, LOCK_P, LOCATION, MAXVALUE, MINVALUE, MOVE, LANCOMPILER, LISTEN, LOAD, LOCATION, LOCK_P, MAXVALUE, MINVALUE, MOVE,
NEW, NONE, NOTHING, NOTNULL, OIDS, OPERATOR, PROCEDURAL, NEW, NOCREATEDB, NOCREATEUSER, NONE, NOTHING, NOTIFY, NOTNULL,
OIDS, OPERATOR, PASSWORD, PROCEDURAL,
RECIPE, RENAME, RESET, RETURNS, ROW, RULE, RECIPE, RENAME, RESET, RETURNS, ROW, RULE,
SEQUENCE, SERIAL, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED, SEQUENCE, SERIAL, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED,
VACUUM, VERBOSE, VERSION, ENCODING, UNLISTEN UNLISTEN, UNTIL, VACUUM, VALID, VERBOSE, VERSION
/* Keywords (obsolete; retain through next version for parser - thomas 1997-12-04) */
%token ARCHIVE
/*
* Tokens for pg_passwd support. The CREATEDB and CREATEUSER tokens should go away
* when some sort of pg_privileges relation is introduced.
*
* Todd A. Brandys
*/
%token PASSWORD, CREATEDB, NOCREATEDB, CREATEUSER, NOCREATEUSER, VALID, UNTIL
/* Special keywords, not in the query language - see the "lex" file */ /* Special keywords, not in the query language - see the "lex" file */
%token <str> IDENT, SCONST, Op %token <str> IDENT, SCONST, Op
...@@ -709,7 +704,7 @@ copy_delimiter: USING DELIMITERS Sconst { $$ = $3; } ...@@ -709,7 +704,7 @@ copy_delimiter: USING DELIMITERS Sconst { $$ = $3; }
*****************************************************************************/ *****************************************************************************/
CreateStmt: CREATE TABLE relation_name '(' OptTableElementList ')' CreateStmt: CREATE TABLE relation_name '(' OptTableElementList ')'
OptInherit OptArchiveType OptInherit
{ {
CreateStmt *n = makeNode(CreateStmt); CreateStmt *n = makeNode(CreateStmt);
n->relname = $3; n->relname = $3;
...@@ -1197,14 +1192,6 @@ OptInherit: INHERITS '(' relation_name_list ')' { $$ = $3; } ...@@ -1197,14 +1192,6 @@ OptInherit: INHERITS '(' relation_name_list ')' { $$ = $3; }
| /*EMPTY*/ { $$ = NIL; } | /*EMPTY*/ { $$ = NIL; }
; ;
/*
* "ARCHIVE" keyword was removed in 6.3, but we keep it for now
* so people can upgrade with old pg_dump scripts. - momjian 1997-11-20(?)
*/
OptArchiveType: ARCHIVE '=' NONE { }
| /*EMPTY*/ { }
;
CreateAsStmt: CREATE TABLE relation_name OptCreateAs AS SubSelect CreateAsStmt: CREATE TABLE relation_name OptCreateAs AS SubSelect
{ {
SelectStmt *n = (SelectStmt *)$6; SelectStmt *n = (SelectStmt *)$6;
...@@ -4646,43 +4633,68 @@ ColId: IDENT { $$ = $1; } ...@@ -4646,43 +4633,68 @@ ColId: IDENT { $$ = $1; }
| datetime { $$ = $1; } | datetime { $$ = $1; }
| ABSOLUTE { $$ = "absolute"; } | ABSOLUTE { $$ = "absolute"; }
| ACTION { $$ = "action"; } | ACTION { $$ = "action"; }
| AFTER { $$ = "after"; }
| AGGREGATE { $$ = "aggregate"; }
| BACKWARD { $$ = "backward"; }
| BEFORE { $$ = "before"; }
| CACHE { $$ = "cache"; } | CACHE { $$ = "cache"; }
| CREATEDB { $$ = "createdb"; }
| CREATEUSER { $$ = "createuser"; }
| CYCLE { $$ = "cycle"; } | CYCLE { $$ = "cycle"; }
| DATABASE { $$ = "database"; } | DATABASE { $$ = "database"; }
| DELIMITERS { $$ = "delimiters"; } | DELIMITERS { $$ = "delimiters"; }
| DOUBLE { $$ = "double"; } | DOUBLE { $$ = "double"; }
| EACH { $$ = "each"; } | EACH { $$ = "each"; }
| ENCODING { $$ = "encoding"; } | ENCODING { $$ = "encoding"; }
| FORWARD { $$ = "forward"; }
| FUNCTION { $$ = "function"; } | FUNCTION { $$ = "function"; }
| HANDLER { $$ = "handler"; }
| INCREMENT { $$ = "increment"; } | INCREMENT { $$ = "increment"; }
| INDEX { $$ = "index"; } | INDEX { $$ = "index"; }
| INHERITS { $$ = "inherits"; }
| INSENSITIVE { $$ = "insensitive"; } | INSENSITIVE { $$ = "insensitive"; }
| INSTEAD { $$ = "instead"; }
| ISNULL { $$ = "isnull"; }
| KEY { $$ = "key"; } | KEY { $$ = "key"; }
| LANGUAGE { $$ = "language"; } | LANGUAGE { $$ = "language"; }
| LANCOMPILER { $$ = "lancompiler"; }
| LOCATION { $$ = "location"; } | LOCATION { $$ = "location"; }
| MATCH { $$ = "match"; } | MATCH { $$ = "match"; }
| MAXVALUE { $$ = "maxvalue"; } | MAXVALUE { $$ = "maxvalue"; }
| MINVALUE { $$ = "minvalue"; } | MINVALUE { $$ = "minvalue"; }
| NEXT { $$ = "next"; } | NEXT { $$ = "next"; }
| NOCREATEDB { $$ = "nocreatedb"; }
| NOCREATEUSER { $$ = "nocreateuser"; }
| NOTHING { $$ = "nothing"; }
| NOTNULL { $$ = "notnull"; }
| OF { $$ = "of"; } | OF { $$ = "of"; }
| OIDS { $$ = "oids"; }
| ONLY { $$ = "only"; } | ONLY { $$ = "only"; }
| OPERATOR { $$ = "operator"; } | OPERATOR { $$ = "operator"; }
| OPTION { $$ = "option"; } | OPTION { $$ = "option"; }
| PASSWORD { $$ = "password"; } | PASSWORD { $$ = "password"; }
| PRIOR { $$ = "prior"; } | PRIOR { $$ = "prior"; }
| PRIVILEGES { $$ = "privileges"; } | PRIVILEGES { $$ = "privileges"; }
| PROCEDURAL { $$ = "procedural"; }
| READ { $$ = "read"; } | READ { $$ = "read"; }
| RECIPE { $$ = "recipe"; } | RECIPE { $$ = "recipe"; }
| RELATIVE { $$ = "relative"; } | RELATIVE { $$ = "relative"; }
| RENAME { $$ = "rename"; }
| RETURNS { $$ = "returns"; }
| ROW { $$ = "row"; } | ROW { $$ = "row"; }
| RULE { $$ = "rule"; }
| SCROLL { $$ = "scroll"; } | SCROLL { $$ = "scroll"; }
| SEQUENCE { $$ = "sequence"; }
| SERIAL { $$ = "serial"; } | SERIAL { $$ = "serial"; }
| START { $$ = "start"; } | START { $$ = "start"; }
| STATEMENT { $$ = "statement"; } | STATEMENT { $$ = "statement"; }
| STDIN { $$ = "stdin"; }
| STDOUT { $$ = "stdout"; }
| TIME { $$ = "time"; } | TIME { $$ = "time"; }
| TIMEZONE_HOUR { $$ = "timezone_hour"; } | TIMEZONE_HOUR { $$ = "timezone_hour"; }
| TIMEZONE_MINUTE { $$ = "timezone_minute"; } | TIMEZONE_MINUTE { $$ = "timezone_minute"; }
| TRIGGER { $$ = "trigger"; } | TRIGGER { $$ = "trigger"; }
| TRUSTED { $$ = "trusted"; }
| TYPE_P { $$ = "type"; } | TYPE_P { $$ = "type"; }
| VALID { $$ = "valid"; } | VALID { $$ = "valid"; }
| VERSION { $$ = "version"; } | VERSION { $$ = "version"; }
...@@ -4700,20 +4712,37 @@ ColId: IDENT { $$ = $1; } ...@@ -4700,20 +4712,37 @@ ColId: IDENT { $$ = $1; }
* when used as a full identifier. - thomas 1997-11-06 * when used as a full identifier. - thomas 1997-11-06
*/ */
ColLabel: ColId { $$ = $1; } ColLabel: ColId { $$ = $1; }
| ARCHIVE { $$ = "archive"; } | ABORT_TRANS { $$ = "abort"; }
| ANALYZE { $$ = "analyze"; }
| BINARY { $$ = "binary"; }
| CLUSTER { $$ = "cluster"; } | CLUSTER { $$ = "cluster"; }
| CONSTRAINT { $$ = "constraint"; } | CONSTRAINT { $$ = "constraint"; }
| COPY { $$ = "copy"; }
| CROSS { $$ = "cross"; } | CROSS { $$ = "cross"; }
| CURRENT { $$ = "current"; }
| DO { $$ = "do"; }
| EXPLAIN { $$ = "explain"; }
| EXTEND { $$ = "extend"; }
| FALSE_P { $$ = "false"; }
| FOREIGN { $$ = "foreign"; } | FOREIGN { $$ = "foreign"; }
| GROUP { $$ = "group"; } | GROUP { $$ = "group"; }
| LISTEN { $$ = "listen"; }
| LOAD { $$ = "load"; } | LOAD { $$ = "load"; }
| LOCK_P { $$ = "lock"; }
| MOVE { $$ = "move"; }
| NEW { $$ = "new"; }
| NONE { $$ = "none"; }
| ORDER { $$ = "order"; } | ORDER { $$ = "order"; }
| POSITION { $$ = "position"; } | POSITION { $$ = "position"; }
| PRECISION { $$ = "precision"; } | PRECISION { $$ = "precision"; }
| RESET { $$ = "reset"; }
| SETOF { $$ = "setof"; }
| SHOW { $$ = "show"; }
| TABLE { $$ = "table"; } | TABLE { $$ = "table"; }
| TRANSACTION { $$ = "transaction"; } | TRANSACTION { $$ = "transaction"; }
| TRUE_P { $$ = "true"; } | TRUE_P { $$ = "true"; }
| FALSE_P { $$ = "false"; } | VACUUM { $$ = "vacuum"; }
| VERBOSE { $$ = "verbose"; }
; ;
SpecialRuleRelation: CURRENT SpecialRuleRelation: CURRENT
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.45 1998/09/13 04:19:31 thomas Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.46 1998/09/30 05:47:57 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -40,7 +40,6 @@ static ScanKeyword ScanKeywords[] = { ...@@ -40,7 +40,6 @@ static ScanKeyword ScanKeywords[] = {
{"analyze", ANALYZE}, {"analyze", ANALYZE},
{"and", AND}, {"and", AND},
{"any", ANY}, {"any", ANY},
{"archive", ARCHIVE},
{"as", AS}, {"as", AS},
{"asc", ASC}, {"asc", ASC},
{"backward", BACKWARD}, {"backward", BACKWARD},
...@@ -116,6 +115,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -116,6 +115,7 @@ static ScanKeyword ScanKeywords[] = {
{"inherits", INHERITS}, {"inherits", INHERITS},
{"inner", INNER_P}, {"inner", INNER_P},
{"insert", INSERT}, {"insert", INSERT},
{"insensitive", INSENSITIVE},
{"instead", INSTEAD}, {"instead", INSTEAD},
{"interval", INTERVAL}, {"interval", INTERVAL},
{"into", INTO}, {"into", INTO},
...@@ -202,6 +202,7 @@ static ScanKeyword ScanKeywords[] = { ...@@ -202,6 +202,7 @@ static ScanKeyword ScanKeywords[] = {
{"substring", SUBSTRING}, {"substring", SUBSTRING},
{"table", TABLE}, {"table", TABLE},
{"time", TIME}, {"time", TIME},
{"timestamp", TIMESTAMP},
{"timezone_hour", TIMEZONE_HOUR}, {"timezone_hour", TIMEZONE_HOUR},
{"timezone_minute", TIMEZONE_MINUTE}, {"timezone_minute", TIMEZONE_MINUTE},
{"to", TO}, {"to", TO},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment