diff options
author | Tom Lane | 2016-05-07 17:16:50 +0000 |
---|---|---|
committer | Tom Lane | 2016-05-07 17:16:50 +0000 |
commit | 691d99de386aa1f5a858e04634dbaaba48488ef8 (patch) | |
tree | 2c738c6ec6750fc92482e25fcf87d840861f7c74 /doc/src/sgml/ref/create_sequence.sgml | |
parent | 7dc1d359699345a2b2af6af6d21bd6f7bd6cfb27 (diff) |
Docs: improve warnings about nextval() not producing gapless sequences.
In the documentation for nextval(), point out explicitly that INSERT ...
ON CONFLICT will call nextval() if needed for the insertion case, whether
or not it ends up following the ON CONFLICT path. This seems to be a
matter of some confusion, cf bug #14126, so let's be clear about it.
Also mention the issue in the CREATE SEQUENCE reference page, since that
is another place where people might expect such things to be covered.
Minor wording improvements nearby, as well.
Back-patch to 9.5 where ON CONFLICT was introduced.
Diffstat (limited to 'doc/src/sgml/ref/create_sequence.sgml')
-rw-r--r-- | doc/src/sgml/ref/create_sequence.sgml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index 9e364ff2409..c9591462eed 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -240,6 +240,16 @@ SELECT * FROM <replaceable>name</replaceable>; </para> <para> + Because <function>nextval</> and <function>setval</> calls are never + rolled back, sequence objects cannot be used if <quote>gapless</> + assignment of sequence numbers is needed. It is possible to build + gapless assignment by using exclusive locking of a table containing a + counter; but this solution is much more expensive than sequence + objects, especially if many transactions need sequence numbers + concurrently. + </para> + + <para> Unexpected results might be obtained if a <replaceable class="parameter">cache</replaceable> setting greater than one is used for a sequence object that will be used concurrently by |