diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-17 01:20:39 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-05-17 01:20:39 +0000 |
commit | caede71b447971399011ef7687f4c68fe5ac9fc6 (patch) | |
tree | 7e3cfe6ad64b35212b54911f26b72800298ee306 /doc/src | |
parent | 3951fae51d776d05e871ee5a7beb62fb832985b1 (diff) | |
download | postgresql-caede71b447971399011ef7687f4c68fe5ac9fc6.tar.gz postgresql-caede71b447971399011ef7687f4c68fe5ac9fc6.zip |
Allow ALTER SEQUENCE START WITH to change the recorded start_value of a
sequence. This seems an obvious extension to the recent patch, and it
makes the code noticeably cleaner and more orthogonal.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/alter_sequence.sgml | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/doc/src/sgml/ref/alter_sequence.sgml b/doc/src/sgml/ref/alter_sequence.sgml index 31e64dac35d..7cf69e9ea3f 100644 --- a/doc/src/sgml/ref/alter_sequence.sgml +++ b/doc/src/sgml/ref/alter_sequence.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/alter_sequence.sgml,v 1.20 2008/05/16 23:36:04 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/alter_sequence.sgml,v 1.21 2008/05/17 01:20:39 tgl Exp $ PostgreSQL documentation --> @@ -26,7 +26,9 @@ PostgreSQL documentation <synopsis> ALTER SEQUENCE <replaceable class="parameter">name</replaceable> [ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ] [ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ] - [ RESTART [ [ WITH ] <replaceable class="parameter">start</replaceable> ] ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ] + [ START [ WITH ] <replaceable class="parameter">start</replaceable> ] + [ RESTART [ [ WITH ] <replaceable class="parameter">restart</replaceable> ] ] + [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ] [ OWNED BY { <replaceable class="parameter">table</replaceable>.<replaceable class="parameter">column</replaceable> | NONE } ] ALTER SEQUENCE <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable> ALTER SEQUENCE <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable> @@ -112,15 +114,29 @@ ALTER SEQUENCE <replaceable class="parameter">name</replaceable> SET SCHEMA <rep <term><replaceable class="parameter">start</replaceable></term> <listitem> <para> + The optional clause <literal>START WITH <replaceable + class="parameter">start</replaceable></literal> changes the + recorded start value of the sequence. This has no effect on the + <emphasis>current</> sequence value; it simply sets the value + that future <command>ALTER SEQUENCE RESTART</> commands will use. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term><replaceable class="parameter">restart</replaceable></term> + <listitem> + <para> The optional clause <literal>RESTART [ WITH <replaceable - class="parameter">start</replaceable> ]</literal> changes the + class="parameter">restart</replaceable> ]</literal> changes the current value of the sequence. This is equivalent to calling the <function>setval</> function with <literal>is_called</literal> = <literal>false</>: the specified value will be returned by the <emphasis>next</> call of <function>nextval</>. Writing <literal>RESTART</> with no <replaceable - class="parameter">start</replaceable> value is equivalent to supplying - the start value used when the sequence was created. + class="parameter">restart</> value is equivalent to supplying + the start value that was recorded by <command>CREATE SEQUENCE</> + or last set by <command>ALTER SEQUENCE START WITH</>. </para> </listitem> </varlistentry> @@ -261,7 +277,8 @@ ALTER SEQUENCE serial RESTART WITH 105; <para> <command>ALTER SEQUENCE</command> conforms to the <acronym>SQL</acronym> - standard, except for the <literal>OWNED BY</>, <literal>RENAME</>, and + standard, except for the <literal>START WITH</>, + <literal>OWNED BY</>, <literal>RENAME</>, and <literal>SET SCHEMA</literal> clauses, which are <productname>PostgreSQL</productname> extensions. </para> |