Skip to content

Commit df9462a

Browse files
author
Thomas G. Lockhart
committed
Implement AT TIME ZONE SQL9x syntax.
AT is now a keyword but is not a reserved word.
1 parent 155e0b9 commit df9462a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/backend/parser/gram.y

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.205 2000/11/05 22:50:20 vadim Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.206 2000/11/06 15:47:17 thomas Exp $
1515
*
1616
* HISTORY
1717
* AUTHOR DATE MAJOR EVENT
@@ -289,7 +289,7 @@ static void doNegateFloat(Value *v);
289289
*/
290290

291291
/* Keywords (in SQL92 reserved words) */
292-
%token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC,
292+
%token ABSOLUTE, ACTION, ADD, ALL, ALTER, AND, ANY, AS, ASC, AT,
293293
BEGIN_TRANS, BETWEEN, BOTH, BY,
294294
CASCADE, CASE, CAST, CHAR, CHARACTER, CHECK, CLOSE,
295295
COALESCE, COLLATE, COLUMN, COMMIT,
@@ -386,6 +386,7 @@ static void doNegateFloat(Value *v);
386386
%left '*' '/' '%'
387387
%left '^'
388388
/* Unary Operators */
389+
%left AT
389390
%right UMINUS
390391
%left '.'
391392
%left '[' ']'
@@ -4298,6 +4299,15 @@ a_expr: c_expr
42984299
{ $$ = $1; }
42994300
| a_expr TYPECAST Typename
43004301
{ $$ = makeTypeCast($1, $3); }
4302+
| a_expr AT TIME ZONE c_expr
4303+
{
4304+
FuncCall *n = makeNode(FuncCall);
4305+
n->funcname = "timezone";
4306+
n->args = makeList2($5, $1);
4307+
n->agg_star = FALSE;
4308+
n->agg_distinct = FALSE;
4309+
$$ = (Node *) n;
4310+
}
43014311
/*
43024312
* These operators must be called out explicitly in order to make use
43034313
* of yacc/bison's automatic operator-precedence handling. All other
@@ -5393,6 +5403,7 @@ TokenId: ABSOLUTE { $$ = "absolute"; }
53935403
| AFTER { $$ = "after"; }
53945404
| AGGREGATE { $$ = "aggregate"; }
53955405
| ALTER { $$ = "alter"; }
5406+
| AT { $$ = "at"; }
53965407
| BACKWARD { $$ = "backward"; }
53975408
| BEFORE { $$ = "before"; }
53985409
| BEGIN_TRANS { $$ = "begin"; }

src/backend/parser/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.82 2000/11/05 22:50:20 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.83 2000/11/06 15:47:17 thomas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -43,6 +43,7 @@ static ScanKeyword ScanKeywords[] = {
4343
{"any", ANY},
4444
{"as", AS},
4545
{"asc", ASC},
46+
{"at", AT},
4647
{"backward", BACKWARD},
4748
{"before", BEFORE},
4849
{"begin", BEGIN_TRANS},

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