Implement AT TIME ZONE SQL9x syntax.

AT is now a keyword but is not a reserved word.
This commit is contained in:
Thomas G. Lockhart 2000-11-06 15:47:17 +00:00
parent 155e0b998a
commit df9462ac05
2 changed files with 15 additions and 3 deletions

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.205 2000/11/05 22:50:20 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.206 2000/11/06 15:47:17 thomas Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -289,7 +289,7 @@ static void doNegateFloat(Value *v);
*/
/* 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, AT,
BEGIN_TRANS, BETWEEN, BOTH, BY,
CASCADE, CASE, CAST, CHAR, CHARACTER, CHECK, CLOSE,
COALESCE, COLLATE, COLUMN, COMMIT,
@ -386,6 +386,7 @@ static void doNegateFloat(Value *v);
%left '*' '/' '%'
%left '^'
/* Unary Operators */
%left AT
%right UMINUS
%left '.'
%left '[' ']'
@ -4298,6 +4299,15 @@ a_expr: c_expr
{ $$ = $1; }
| a_expr TYPECAST Typename
{ $$ = makeTypeCast($1, $3); }
| a_expr AT TIME ZONE c_expr
{
FuncCall *n = makeNode(FuncCall);
n->funcname = "timezone";
n->args = makeList2($5, $1);
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *) n;
}
/*
* These operators must be called out explicitly in order to make use
* of yacc/bison's automatic operator-precedence handling. All other
@ -5393,6 +5403,7 @@ TokenId: ABSOLUTE { $$ = "absolute"; }
| AFTER { $$ = "after"; }
| AGGREGATE { $$ = "aggregate"; }
| ALTER { $$ = "alter"; }
| AT { $$ = "at"; }
| BACKWARD { $$ = "backward"; }
| BEFORE { $$ = "before"; }
| BEGIN_TRANS { $$ = "begin"; }

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.82 2000/11/05 22:50:20 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.83 2000/11/06 15:47:17 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@ -43,6 +43,7 @@ static ScanKeyword ScanKeywords[] = {
{"any", ANY},
{"as", AS},
{"asc", ASC},
{"at", AT},
{"backward", BACKWARD},
{"before", BEFORE},
{"begin", BEGIN_TRANS},