1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Tweak CREATE SEQUENCE grammar to be more SQL1999 standards compliant.

Neil Conway
This commit is contained in:
Bruce Momjian
2002-11-10 00:10:20 +00:00
parent ebb531836a
commit 3eabc4490e
3 changed files with 34 additions and 19 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.88 2002/09/22 19:42:50 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.89 2002/11/10 00:10:20 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -798,11 +798,7 @@ init_params(CreateSeqStmt *seq, Form_pg_sequence new)
else if (strcmp(defel->defname, "cache") == 0)
cache_value = defel;
else if (strcmp(defel->defname, "cycle") == 0)
{
if (defel->arg != (Node *) NULL)
elog(ERROR, "DefineSequence: CYCLE ??");
new->is_cycled = true;
}
new->is_cycled = (defel->arg != NULL);
else
elog(ERROR, "DefineSequence: option \"%s\" not recognized",
defel->defname);

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.374 2002/11/09 23:56:39 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.375 2002/11/10 00:10:20 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -1893,11 +1893,15 @@ OptSeqElem: CACHE NumericOnly
}
| CYCLE
{
$$ = makeDefElem("cycle", (Node *)NULL);
$$ = makeDefElem("cycle", (Node *)true);
}
| INCREMENT NumericOnly
| NO CYCLE
{
$$ = makeDefElem("increment", (Node *)$2);
$$ = makeDefElem("cycle", (Node *)false);
}
| INCREMENT opt_by NumericOnly
{
$$ = makeDefElem("increment", (Node *)$3);
}
| MAXVALUE NumericOnly
{
@@ -1907,12 +1911,16 @@ OptSeqElem: CACHE NumericOnly
{
$$ = makeDefElem("minvalue", (Node *)$2);
}
| START NumericOnly
| START opt_with NumericOnly
{
$$ = makeDefElem("start", (Node *)$2);
$$ = makeDefElem("start", (Node *)$3);
}
;
opt_by: BY {}
| /* empty */ {}
;
NumericOnly:
FloatOnly { $$ = $1; }
| IntegerOnly { $$ = $1; }