@@ -9820,6 +9820,27 @@ nextval('foo'::text) <lineannotation><literal>foo</literal> is looked up at
9820
9820
execute <function>nextval</function> concurrently, each will safely receive
9821
9821
a distinct sequence value.
9822
9822
</para>
9823
+
9824
+ <para>
9825
+ If a sequence object has been created with default parameters,
9826
+ successive <function>nextval</function> calls will return successive
9827
+ values beginning with 1. Other behaviors can be obtained by using
9828
+ special parameters in the <xref linkend="sql-createsequence"> command;
9829
+ see its command reference page for more information.
9830
+ </para>
9831
+
9832
+ <important>
9833
+ <para>
9834
+ To avoid blocking concurrent transactions that obtain numbers from the
9835
+ same sequence, a <function>nextval</function> operation is never
9836
+ rolled back; that is, once a value has been fetched it is considered
9837
+ used, even if the transaction that did the
9838
+ <function>nextval</function> later aborts. This means that aborted
9839
+ transactions might leave unused <quote>holes</quote> in the sequence
9840
+ of assigned values.
9841
+ </para>
9842
+ </important>
9843
+
9823
9844
</listitem>
9824
9845
</varlistentry>
9825
9846
@@ -9883,31 +9904,18 @@ SELECT setval('foo', 42, false); <lineannotation>Next <function>nextval</> wi
9883
9904
The result returned by <function>setval</function> is just the value of its
9884
9905
second argument.
9885
9906
</para>
9907
+ <important>
9908
+ <para>
9909
+ Because sequences are non-transactional, changes made by
9910
+ <function>setval</function> are not undone if the transaction rolls
9911
+ back.
9912
+ </para>
9913
+ </important>
9886
9914
</listitem>
9887
9915
</varlistentry>
9888
9916
</variablelist>
9889
9917
</para>
9890
9918
9891
- <para>
9892
- If a sequence object has been created with default parameters,
9893
- successive <function>nextval</function> calls will return successive values
9894
- beginning with 1. Other behaviors can be obtained by using
9895
- special parameters in the <xref linkend="sql-createsequence"> command;
9896
- see its command reference page for more information.
9897
- </para>
9898
-
9899
- <important>
9900
- <para>
9901
- To avoid blocking concurrent transactions that obtain numbers from the
9902
- same sequence, a <function>nextval</function> operation is never rolled back;
9903
- that is, once a value has been fetched it is considered used, even if the
9904
- transaction that did the <function>nextval</function> later aborts. This means
9905
- that aborted transactions might leave unused <quote>holes</quote> in the
9906
- sequence of assigned values. <function>setval</function> operations are never
9907
- rolled back, either.
9908
- </para>
9909
- </important>
9910
-
9911
9919
</sect1>
9912
9920
9913
9921
0 commit comments