doc: improve create/alter sequence CYCLE syntax
Reported-by: Peter Smith Discussion: https://postgr.es/m/CAHut+PtqwZwPfGq62xq2614_ce2ejDmbB9CfP+a1azxpneFRBQ@mail.gmail.com Author: Peter Smith Backpatch-through: master
This commit is contained in:
parent
e28a2719be
commit
9380e5f129
@ -27,9 +27,10 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
|
||||
[ AS <replaceable class="parameter">data_type</replaceable> ]
|
||||
[ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ]
|
||||
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ]
|
||||
[ [ NO ] CYCLE ]
|
||||
[ START [ WITH ] <replaceable class="parameter">start</replaceable> ]
|
||||
[ RESTART [ [ WITH ] <replaceable class="parameter">restart</replaceable> ] ]
|
||||
[ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
|
||||
[ CACHE <replaceable class="parameter">cache</replaceable> ]
|
||||
[ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
|
||||
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET { LOGGED | UNLOGGED }
|
||||
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
|
||||
@ -154,6 +155,38 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CYCLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The optional <literal>CYCLE</literal> key word can 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
|
||||
an ascending or descending sequence respectively. If the limit is
|
||||
reached, the next number generated will be the
|
||||
<replaceable class="parameter">minvalue</replaceable> or
|
||||
<replaceable class="parameter">maxvalue</replaceable>,
|
||||
respectively.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>NO CYCLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the optional <literal>NO CYCLE</literal> key word is
|
||||
specified, any calls to <function>nextval</function> after the
|
||||
sequence has reached its maximum value will return an error.
|
||||
If neither <literal>CYCLE</literal> or <literal>NO
|
||||
CYCLE</literal> are specified, the old cycle behavior will be
|
||||
maintained.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">start</replaceable></term>
|
||||
<listitem>
|
||||
@ -207,38 +240,6 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CYCLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The optional <literal>CYCLE</literal> key word can 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
|
||||
an ascending or descending sequence respectively. If the limit is
|
||||
reached, the next number generated will be the
|
||||
<replaceable class="parameter">minvalue</replaceable> or
|
||||
<replaceable class="parameter">maxvalue</replaceable>,
|
||||
respectively.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>NO CYCLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the optional <literal>NO CYCLE</literal> key word is
|
||||
specified, any calls to <function>nextval</function> after the
|
||||
sequence has reached its maximum value will return an error.
|
||||
If neither <literal>CYCLE</literal> or <literal>NO
|
||||
CYCLE</literal> are specified, the old cycle behavior will be
|
||||
maintained.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>SET { LOGGED | UNLOGGED }</literal></term>
|
||||
<listitem>
|
||||
|
@ -25,7 +25,9 @@ CREATE [ { TEMPORARY | TEMP } | UNLOGGED ] SEQUENCE [ IF NOT EXISTS ] <replaceab
|
||||
[ AS <replaceable class="parameter">data_type</replaceable> ]
|
||||
[ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ]
|
||||
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ]
|
||||
[ START [ WITH ] <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
|
||||
[ [ NO ] CYCLE ]
|
||||
[ START [ WITH ] <replaceable class="parameter">start</replaceable> ]
|
||||
[ CACHE <replaceable class="parameter">cache</replaceable> ]
|
||||
[ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
|
||||
</synopsis>
|
||||
</refsynopsisdiv>
|
||||
@ -193,6 +195,31 @@ SELECT * FROM <replaceable>name</replaceable>;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CYCLE</literal></term>
|
||||
<term><literal>NO CYCLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>CYCLE</literal> option allows the sequence to wrap
|
||||
around when the <replaceable
|
||||
class="parameter">maxvalue</replaceable> or <replaceable
|
||||
class="parameter">minvalue</replaceable> has been reached by an
|
||||
ascending or descending sequence respectively. If the limit is
|
||||
reached, the next number generated will be the <replaceable
|
||||
class="parameter">minvalue</replaceable> or <replaceable
|
||||
class="parameter">maxvalue</replaceable>, respectively.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If <literal>NO CYCLE</literal> is specified, any calls to
|
||||
<function>nextval</function> after the sequence has reached its
|
||||
maximum value will return an error. If neither
|
||||
<literal>CYCLE</literal> or <literal>NO CYCLE</literal> are
|
||||
specified, <literal>NO CYCLE</literal> is the default.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><replaceable class="parameter">start</replaceable></term>
|
||||
<listitem>
|
||||
@ -221,31 +248,6 @@ SELECT * FROM <replaceable>name</replaceable>;
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>CYCLE</literal></term>
|
||||
<term><literal>NO CYCLE</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>CYCLE</literal> option allows the sequence to wrap
|
||||
around when the <replaceable
|
||||
class="parameter">maxvalue</replaceable> or <replaceable
|
||||
class="parameter">minvalue</replaceable> has been reached by an
|
||||
ascending or descending sequence respectively. If the limit is
|
||||
reached, the next number generated will be the <replaceable
|
||||
class="parameter">minvalue</replaceable> or <replaceable
|
||||
class="parameter">maxvalue</replaceable>, respectively.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If <literal>NO CYCLE</literal> is specified, any calls to
|
||||
<function>nextval</function> after the sequence has reached its
|
||||
maximum value will return an error. If neither
|
||||
<literal>CYCLE</literal> or <literal>NO CYCLE</literal> are
|
||||
specified, <literal>NO CYCLE</literal> is the default.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>OWNED BY</literal> <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable></term>
|
||||
<term><literal>OWNED BY NONE</literal></term>
|
||||
|
Loading…
x
Reference in New Issue
Block a user