Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
95282d35
Commit
95282d35
authored
13 years ago
by
Robert Haas
Browse files
Options
Downloads
Patches
Plain Diff
Warn more vigorously about the non-transactional behavior of sequences.
Craig Ringer, edited fairly heavily by me
parent
f5f8e716
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/src/sgml/datatype.sgml
+14
-0
14 additions, 0 deletions
doc/src/sgml/datatype.sgml
doc/src/sgml/func.sgml
+28
-20
28 additions, 20 deletions
doc/src/sgml/func.sgml
with
42 additions
and
20 deletions
doc/src/sgml/datatype.sgml
+
14
−
0
View file @
95282d35
...
@@ -829,6 +829,20 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
...
@@ -829,6 +829,20 @@ ALTER SEQUENCE <replaceable class="parameter">tablename</replaceable>_<replaceab
the column, so that it will be dropped if the column or table is dropped.
the column, so that it will be dropped if the column or table is dropped.
</para>
</para>
<note>
<para>
Because <type>smallserial</type>, <type>serial</type> and
<type>bigserial</type> are implemented usings sequences, there may
be "holes" or gaps in the sequence of values which appears in the
column, even if no rows are ever deleted. This is a value allocated
from the sequence is still "used up" even if a row containing that
value is never successfully inserted into the table column. This
may happen, for example, if the inserting transaction rolls back.
See <literal>nextval()</literal> in <xref linkend="functions-sequence">
for details.
</para>
</note>
<note>
<note>
<para>
<para>
Prior to <productname>PostgreSQL</productname> 7.3, <type>serial</type>
Prior to <productname>PostgreSQL</productname> 7.3, <type>serial</type>
...
...
This diff is collapsed.
Click to expand it.
doc/src/sgml/func.sgml
+
28
−
20
View file @
95282d35
...
@@ -9820,6 +9820,27 @@ nextval('foo'::text) <lineannotation><literal>foo</literal> is looked up at
...
@@ -9820,6 +9820,27 @@ nextval('foo'::text) <lineannotation><literal>foo</literal> is looked up at
execute <function>nextval</function> concurrently, each will safely receive
execute <function>nextval</function> concurrently, each will safely receive
a distinct sequence value.
a distinct sequence value.
</para>
</para>
<para>
If a sequence object has been created with default parameters,
successive <function>nextval</function> calls will return successive
values beginning with 1. Other behaviors can be obtained by using
special parameters in the <xref linkend="sql-createsequence"> command;
see its command reference page for more information.
</para>
<important>
<para>
To avoid blocking concurrent transactions that obtain numbers from the
same sequence, a <function>nextval</function> operation is never
rolled back; that is, once a value has been fetched it is considered
used, even if the transaction that did the
<function>nextval</function> later aborts. This means that aborted
transactions might leave unused <quote>holes</quote> in the sequence
of assigned values.
</para>
</important>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -9883,30 +9904,17 @@ SELECT setval('foo', 42, false); <lineannotation>Next <function>nextval</> wi
...
@@ -9883,30 +9904,17 @@ SELECT setval('foo', 42, false); <lineannotation>Next <function>nextval</> wi
The result returned by <function>setval</function> is just the value of its
The result returned by <function>setval</function> is just the value of its
second argument.
second argument.
</para>
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
If a sequence object has been created with default parameters,
successive <function>nextval</function> calls will return successive values
beginning with 1. Other behaviors can be obtained by using
special parameters in the <xref linkend="sql-createsequence"> command;
see its command reference page for more information.
</para>
<important>
<important>
<para>
<para>
To avoid blocking concurrent transactions that obtain numbers from the
Because sequences are non-transactional, changes made by
same sequence, a <function>nextval</function> operation is never rolled back;
<function>setval</function> are not undone if the transaction rolls
that is, once a value has been fetched it is considered used, even if the
back.
transaction that did the <function>nextval</function> later aborts. This means
that aborted transactions might leave unused <quote>holes</quote> in the
sequence of assigned values. <function>setval</function> operations are never
rolled back, either.
</para>
</para>
</important>
</important>
</listitem>
</varlistentry>
</variablelist>
</para>
</sect1>
</sect1>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment