Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
3eabc449
Commit
3eabc449
authored
22 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Tweak CREATE SEQUENCE grammar to be more SQL1999 standards compliant.
Neil Conway
parent
ebb53183
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
doc/src/sgml/ref/create_sequence.sgml
+18
-7
18 additions, 7 deletions
doc/src/sgml/ref/create_sequence.sgml
src/backend/commands/sequence.c
+2
-6
2 additions, 6 deletions
src/backend/commands/sequence.c
src/backend/parser/gram.y
+14
-6
14 additions, 6 deletions
src/backend/parser/gram.y
with
34 additions
and
19 deletions
doc/src/sgml/ref/create_sequence.sgml
+
18
−
7
View file @
3eabc449
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.2
8
2002/
05/18 15:44:47 petere
Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.2
9
2002/
11/10 00:10:20 momjian
Exp $
PostgreSQL documentation
-->
...
...
@@ -21,9 +21,9 @@ PostgreSQL documentation
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT <replaceable class="parameter">increment</replaceable> ]
CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</replaceable> [ INCREMENT
[ BY ]
<replaceable class="parameter">increment</replaceable> ]
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> ]
[ START <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ CYCLE ]
[ START
[ WITH ]
<replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [
[ NO ]
CYCLE ]
</synopsis>
<refsect2 id="R2-SQL-CREATESEQUENCE-1">
...
...
@@ -130,8 +130,8 @@ CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</rep
<term>CYCLE</term>
<listitem>
<para>
The optional
CYCLE
keyword may be used to enable
the sequence
to wrap around when the
The optional
<option>CYCLE</option>
keyword may be used to enable
the sequence
to wrap around when the
<replaceable class="parameter">maxvalue</replaceable> or
<replaceable class="parameter">minvalue</replaceable> has been
reached by
...
...
@@ -140,8 +140,19 @@ CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">seqname</rep
<replaceable class="parameter">minvalue</replaceable> or
<replaceable class="parameter">maxvalue</replaceable>,
respectively.
Without CYCLE, after the limit is reached <function>nextval</> calls
will return an error.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>NO CYCLE</term>
<listitem>
<para>
If the optional <option>NO CYCLE</option> keyword is specified, any
calls to <function>nextval</function> after the sequence has reached
its maximum value will return an error. If neither
<option>CYCLE</option> or <option>NO CYCLE</option> are specified,
<option>NO CYCLE</option> is the default.
</para>
</listitem>
</varlistentry>
...
...
This diff is collapsed.
Click to expand it.
src/backend/commands/sequence.c
+
2
−
6
View file @
3eabc449
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.8
8
2002/
09/22 19:42:50 tgl
Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/sequence.c,v 1.8
9
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
);
...
...
This diff is collapsed.
Click to expand it.
src/backend/parser/gram.y
+
14
−
6
View file @
3eabc449
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.37
4
2002/11/
09 23:56:39
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.37
5
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; }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment