Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 12cf9f8

Browse files
author
Thomas G. Lockhart
committed
Support SERIAL column type. Expand into an integer column but mark
is_sequence in the ColumnDef structure.
1 parent fddd79a commit 12cf9f8

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/backend/parser/gram.y

Lines changed: 16 additions & 2 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 2.24 1998/08/24 01:13:44 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.25 1998/08/25 15:04:23 thomas Exp $
1414
*
1515
* HISTORY
1616
* AUTHOR DATE MAJOR EVENT
@@ -294,7 +294,7 @@ Oid param_type(int t); /* used in parse_expr.c */
294294
LANCOMPILER, LISTEN, LOAD, LOCK_P, LOCATION, MAXVALUE, MINVALUE, MOVE,
295295
NEW, NONE, NOTHING, NOTNULL, OIDS, OPERATOR, PROCEDURAL,
296296
RECIPE, RENAME, RESET, RETURNS, ROW, RULE,
297-
SEQUENCE, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED,
297+
SEQUENCE, SERIAL, SETOF, SHOW, START, STATEMENT, STDIN, STDOUT, TRUSTED,
298298
VACUUM, VERBOSE, VERSION, ENCODING
299299

300300
/* Keywords (obsolete; retain through next version for parser - thomas 1997-12-04) */
@@ -747,6 +747,19 @@ columnDef: ColId Typename ColQualifier
747747
n->defval = NULL;
748748
n->is_not_null = FALSE;
749749
n->constraints = $3;
750+
$$ = (Node *)n;
751+
}
752+
| ColId SERIAL
753+
{
754+
ColumnDef *n = makeNode(ColumnDef);
755+
n->colname = $1;
756+
n->typename = makeNode(TypeName);
757+
n->typename->name = xlateSqlType("integer");
758+
n->defval = NULL;
759+
n->is_not_null = TRUE;
760+
n->is_sequence = TRUE;
761+
n->constraints = NULL;
762+
750763
$$ = (Node *)n;
751764
}
752765
;
@@ -4541,6 +4554,7 @@ ColId: IDENT { $$ = $1; }
45414554
| PRIVILEGES { $$ = "privileges"; }
45424555
| RECIPE { $$ = "recipe"; }
45434556
| ROW { $$ = "row"; }
4557+
| SERIAL { $$ = "serial"; }
45444558
| START { $$ = "start"; }
45454559
| STATEMENT { $$ = "statement"; }
45464560
| TIME { $$ = "time"; }

src/backend/parser/keywords.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.40 1998/08/24 01:39:18 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.41 1998/08/25 15:04:24 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -186,6 +186,7 @@ static ScanKeyword ScanKeywords[] = {
186186
{"second", SECOND_P},
187187
{"select", SELECT},
188188
{"sequence", SEQUENCE},
189+
{"serial", SERIAL},
189190
{"set", SET},
190191
{"setof", SETOF},
191192
{"show", SHOW},

0 commit comments

Comments
 (0)