Skip to content

Commit f54cc39

Browse files
author
Thomas G. Lockhart
committed
Allow TIME in column and table names (SQL/92 non-reserved word).
1 parent 8bd813d commit f54cc39

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/backend/parser/gram.y

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.53 1997/09/29 05:58:12 vadim Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.54 1997/10/09 05:00:54 thomas Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -2308,9 +2308,8 @@ nest_array_bounds: '[' ']' nest_array_bounds
23082308
/*
23092309
* typname handles types without trailing parens for size specification.
23102310
* Typename uses either typname or explicit txname(size).
2311-
* So, must handle float in both places. - thomas 1997-09-20
2311+
* So, must handle FLOAT in both places. - thomas 1997-09-20
23122312
*/
2313-
23142313
typname: txname
23152314
{
23162315
char *tname;
@@ -2352,7 +2351,16 @@ typname: txname
23522351
}
23532352
;
23542353

2354+
/* Type names
2355+
* Allow the following parsing categories:
2356+
* - strings which are not keywords (Id)
2357+
* - some explicit SQL/92 data types (e.g. DOUBLE PRECISION)
2358+
* - TIME as an SQL/92 non-reserved word, but parser keyword
2359+
* - other date/time strings (e.g. YEAR)
2360+
* - thomas 1997-10-08
2361+
*/
23552362
txname: Id { $$ = $1; }
2363+
| DateTime { $$ = $1; }
23562364
| TIME { $$ = xlateSqlType("time"); }
23572365
| INTERVAL interval_opts { $$ = xlateSqlType("interval"); }
23582366
| CHARACTER char_type { $$ = $2; }
@@ -3131,6 +3139,7 @@ class: Id { $$ = $1; };
31313139
index_name: Id { $$ = $1; };
31323140

31333141
name: Id { $$ = $1; }
3142+
| DateTime { $$ = $1; }
31343143
| TIME { $$ = xlateSqlType("time"); }
31353144
;
31363145

@@ -3179,8 +3188,14 @@ Sconst: SCONST { $$ = $1; };
31793188

31803189
Id: IDENT { $$ = $1; };
31813190

3191+
/* Column identifier (also used for table identifier)
3192+
* Allow date/time names ("year", etc.) (SQL/92 extension).
3193+
* Allow TIME (SQL/92 non-reserved word).
3194+
* - thomas 1997-10-08
3195+
*/
31823196
ColId: Id { $$ = $1; }
31833197
| DateTime { $$ = $1; }
3198+
| TIME { $$ = "time"; }
31843199
;
31853200

31863201
SpecialRuleRelation: CURRENT

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