From d2a907c6ad28413bf85660ea590e0e21e0d7016c Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Wed, 16 Sep 1998 14:43:12 +0000 Subject: Markup and editing adjustments... --- doc/src/sgml/ref/create_sequence.sgml | 123 ++++++++++++++++++++-------------- 1 file changed, 73 insertions(+), 50 deletions(-) (limited to 'doc/src/sgml/ref/create_sequence.sgml') diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index 20d03240e3..d678bb319c 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -18,34 +18,28 @@ 1998-04-15 - CREATE SEQUENCE seqname - [INCREMENT increment] - [MINVALUE minvalue] - [MAXVALUE maxvalue] - [START start] - [CACHE cache] - [CYCLE] +CREATE SEQUENCE seqname + [ INCREMENT increment ] + [ MINVALUE minvalue ] + [ MAXVALUE maxvalue ] + [ START start ] + [ CACHE cache ] + [ CYCLE ] - 1998-04-15 + 1998-09-11 Inputs - - - - - - - seqname + seqname @@ -55,19 +49,19 @@ - increment + increment The clause is optional. A positive value will make an - ascending sequence, a negative one a descending sequence. The default value - is 1. + ascending sequence, a negative one a descending sequence. + The default value is one (1). - minvalue + minvalue @@ -81,7 +75,7 @@ - maxvalue + maxvalue @@ -95,7 +89,7 @@ - start + start @@ -107,15 +101,12 @@ for ascending sequences and maxvalue for descending ones. - - What happens if the user specifies start outside the range? - - cache + cache @@ -128,7 +119,7 @@ - CYCLE + CYCLE @@ -146,14 +137,11 @@ - - - - 1998-04-15 + 1998-09-11 Outputs @@ -163,6 +151,7 @@ <VARIABLELIST> <VARLISTENTRY> <TERM> +<replaceable>status</replaceable> </TERM> <LISTITEM> <PARA> @@ -179,7 +168,7 @@ </VARLISTENTRY> <VARLISTENTRY> <TERM> - <ReturnValue>ERROR: amcreate: '<replaceable class="parameter"> seqname</replaceable>' relation already exists</ReturnValue> +<ReturnValue>ERROR: amcreate: '<replaceable class="parameter">seqname</replaceable>' relation already exists</ReturnValue> </TERM> <LISTITEM> <PARA> @@ -187,6 +176,36 @@ </PARA> </LISTITEM> </VARLISTENTRY> + <VARLISTENTRY> + <TERM> +<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be > MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue> + </TERM> + <LISTITEM> + <PARA> + If the specified starting value is out of range. + </PARA> + </LISTITEM> + </VARLISTENTRY> + <VARLISTENTRY> + <TERM> +<ReturnValue>ERROR: DefineSequence: START value (<replaceable class="parameter">start</replaceable>) can't be < MINVALUE (<replaceable class="parameter">minvalue</replaceable>)</ReturnValue> + </TERM> + <LISTITEM> + <PARA> + If the specified starting value is out of range. + </PARA> + </LISTITEM> + </VARLISTENTRY> + <VARLISTENTRY> + <TERM> +<ReturnValue>ERROR: DefineSequence: MINVALUE (<replaceable class="parameter">minvalue</replaceable>) can't be >= MAXVALUE (<replaceable class="parameter">maxvalue</replaceable>)</ReturnValue> + </TERM> + <LISTITEM> + <PARA> + If the minimum and maximum values are inconsistant. + </PARA> + </LISTITEM> + </VARLISTENTRY> </variablelist> </LISTITEM> </VARLISTENTRY> @@ -196,7 +215,7 @@ <REFSECT1 ID="R1-SQL-CREATESEQUENCE-1"> <REFSECT1INFO> - <DATE>1998-04-15</DATE> + <DATE>1998-09-11</DATE> </REFSECT1INFO> <TITLE> Description @@ -210,18 +229,20 @@ </PARA> <para> After the sequence is created, you may use the function - <function>nextval()</function> with the - sequence name as the argument to get a new number from the sequence. - The function <function>currval('<replaceable class="parameter">sequence_name</replaceable>')</function> may be used +<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function> +to get a new number from the sequence. +The function +<function>currval('<replaceable class="parameter">seqname</replaceable>')</function> + may be used to determine the number returned by the last call to - <function>nextval()</function> for the - specified sequence in the current session. +<function>nextval(<replaceable class="parameter">seqname</replaceable>)</function> + for the specified sequence in the current session. </para> <para> Use a query like <programlisting> - SELECT * FROM sequence_name; +SELECT * FROM sequence_name; </programlisting> to get the parameters of a sequence. </para> @@ -232,7 +253,7 @@ <REFSECT2 ID="R2-SQL-CREATESEQUENCE-3"> <REFSECT2INFO> - <DATE>1998-04-15</DATE> + <DATE>1998-09-11</DATE> </REFSECT2INFO> <TITLE> Notes @@ -243,7 +264,7 @@ <para> Each backend uses its own cache to store allocated numbers. Numbers that are cached but not used in the current session will be - lost. + lost, resulting in "holes" in the sequence. </para> </REFSECT2> </refsect1> @@ -253,25 +274,25 @@ Usage - Create an ascending sequence called serial, starting at 101: + Create an ascending sequence called serial, starting at 101: - CREATE SEQUENCE serial START 101; +CREATE SEQUENCE serial START 101; Select the next number from this sequence - SELECT NEXTVAL ('serial'); +SELECT NEXTVAL ('serial'); - nextval - ------- - 114 +nextval +------- + 114 Use this sequence in an INSERT: - INSERT INTO distributors VALUES (NEXTVAL ('serial'),'nothing'); +INSERT INTO distributors VALUES (NEXTVAL('serial'),'nothing'); @@ -281,18 +302,20 @@ Compatibility - CREATE SEQUENCE statement is a PostgreSQL language extension. + CREATE SEQUENCE is a Postgres + language extension. - 1998-04-15 + 1998-09-11 SQL92 - There is no CREATE SEQUENCE statement on SQL92. + There is no CREATE SEQUENCE statement + in SQL92. -- cgit v1.2.1