Index: doc/src/sgml/ref/create_sequence.sgml
===================================================================
RCS file: /var/lib/cvs/pgsql-server/doc/src/sgml/ref/create_sequence.sgml,v
retrieving revision 1.28
diff -c -r1.28 create_sequence.sgml
*** doc/src/sgml/ref/create_sequence.sgml 18 May 2002 15:44:47 -0000 1.28
--- doc/src/sgml/ref/create_sequence.sgml 28 Sep 2002 01:31:36 -0000
***************
*** 21,29 ****
1999-07-20
! CREATE [ TEMPORARY | TEMP ] SEQUENCE seqname [ INCREMENT increment ]
[ MINVALUE minvalue ] [ MAXVALUE maxvalue ]
! [ START start ] [ CACHE cache ] [ CYCLE ]
--- 21,29 ----
1999-07-20
! CREATE [ TEMPORARY | TEMP ] SEQUENCE seqname [ INCREMENT [ BY ] increment ]
[ MINVALUE minvalue ] [ MAXVALUE maxvalue ]
! [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
***************
*** 130,137 ****
CYCLE
! The optional CYCLE keyword may be used to enable the sequence
! to wrap around when the
maxvalue or
minvalue has been
reached by
--- 130,137 ----
CYCLE
! The optional keyword may be used to enable
! the sequence to wrap around when the
maxvalue or
minvalue has been
reached by
***************
*** 140,150 ****
minvalue or
maxvalue,
respectively.
- Without CYCLE, after the limit is reached nextval> calls
- will return an error.
--- 140,161 ----
minvalue or
maxvalue,
respectively.
+
+
+ NO CYCLE
+
+
+ If the optional keyword is specified, any
+ calls to nextval after the sequence has reached
+ its maximum value will return an error. If neither
+ or are specified,
+ is the default.
+
+
+
Index: src/backend/commands/sequence.c
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/commands/sequence.c,v
retrieving revision 1.88
diff -c -r1.88 sequence.c
*** src/backend/commands/sequence.c 22 Sep 2002 19:42:50 -0000 1.88
--- src/backend/commands/sequence.c 28 Sep 2002 01:10:18 -0000
***************
*** 798,808 ****
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;
! }
else
elog(ERROR, "DefineSequence: option \"%s\" not recognized",
defel->defname);
--- 798,804 ----
else if (strcmp(defel->defname, "cache") == 0)
cache_value = defel;
else if (strcmp(defel->defname, "cycle") == 0)
! new->is_cycled = (defel->arg != NULL);
else
elog(ERROR, "DefineSequence: option \"%s\" not recognized",
defel->defname);
Index: src/backend/parser/gram.y
===================================================================
RCS file: /var/lib/cvs/pgsql-server/src/backend/parser/gram.y,v
retrieving revision 2.370
diff -c -r2.370 gram.y
*** src/backend/parser/gram.y 22 Sep 2002 21:44:43 -0000 2.370
--- src/backend/parser/gram.y 28 Sep 2002 01:29:35 -0000
***************
*** 1883,1893 ****
}
| CYCLE
{
! $$ = makeDefElem("cycle", (Node *)NULL);
}
! | INCREMENT NumericOnly
{
! $$ = makeDefElem("increment", (Node *)$2);
}
| MAXVALUE NumericOnly
{
--- 1883,1897 ----
}
| CYCLE
{
! $$ = makeDefElem("cycle", (Node *)true);
}
! | NO CYCLE
{
! $$ = makeDefElem("cycle", (Node *)false);
! }
! | INCREMENT opt_by NumericOnly
! {
! $$ = makeDefElem("increment", (Node *)$3);
}
| MAXVALUE NumericOnly
{
***************
*** 1897,1907 ****
{
$$ = makeDefElem("minvalue", (Node *)$2);
}
! | START NumericOnly
{
! $$ = makeDefElem("start", (Node *)$2);
}
;
NumericOnly:
FloatOnly { $$ = $1; }
--- 1901,1915 ----
{
$$ = makeDefElem("minvalue", (Node *)$2);
}
! | START opt_with NumericOnly
{
! $$ = makeDefElem("start", (Node *)$3);
}
;
+
+ opt_by: BY {}
+ | /* empty */ {}
+ ;
NumericOnly:
FloatOnly { $$ = $1; }