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

Implement AT TIME ZONE SQL9x syntax.

 AT is now a keyword but is not a reserved word.
parent 155e0b99
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -289,7 +289,7 @@ static void doNegateFloat(Value *v); ...@@ -289,7 +289,7 @@ 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, %token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC, AT,
BEGIN_TRANS, BETWEEN, BOTH, BY, 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,
...@@ -386,6 +386,7 @@ static void doNegateFloat(Value *v); ...@@ -386,6 +386,7 @@ static void doNegateFloat(Value *v);
%left '*' '/' '%' %left '*' '/' '%'
%left '^' %left '^'
/* Unary Operators */ /* Unary Operators */
%left AT
%right UMINUS %right UMINUS
%left '.' %left '.'
%left '[' ']' %left '[' ']'
...@@ -4298,6 +4299,15 @@ a_expr: c_expr ...@@ -4298,6 +4299,15 @@ a_expr: c_expr
{ $$ = $1; } { $$ = $1; }
| a_expr TYPECAST Typename | a_expr TYPECAST Typename
{ $$ = makeTypeCast($1, $3); } { $$ = 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 * These operators must be called out explicitly in order to make use
* of yacc/bison's automatic operator-precedence handling. All other * of yacc/bison's automatic operator-precedence handling. All other
...@@ -5393,6 +5403,7 @@ TokenId: ABSOLUTE { $$ = "absolute"; } ...@@ -5393,6 +5403,7 @@ TokenId: ABSOLUTE { $$ = "absolute"; }
| AFTER { $$ = "after"; } | AFTER { $$ = "after"; }
| AGGREGATE { $$ = "aggregate"; } | AGGREGATE { $$ = "aggregate"; }
| ALTER { $$ = "alter"; } | ALTER { $$ = "alter"; }
| AT { $$ = "at"; }
| BACKWARD { $$ = "backward"; } | BACKWARD { $$ = "backward"; }
| BEFORE { $$ = "before"; } | BEFORE { $$ = "before"; }
| BEGIN_TRANS { $$ = "begin"; } | BEGIN_TRANS { $$ = "begin"; }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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[] = { ...@@ -43,6 +43,7 @@ static ScanKeyword ScanKeywords[] = {
{"any", ANY}, {"any", ANY},
{"as", AS}, {"as", AS},
{"asc", ASC}, {"asc", ASC},
{"at", AT},
{"backward", BACKWARD}, {"backward", BACKWARD},
{"before", BEFORE}, {"before", BEFORE},
{"begin", BEGIN_TRANS}, {"begin", BEGIN_TRANS},
......
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