diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml index 218988e..75b1bd4 100644 --- a/doc/src/sgml/advanced.sgml +++ b/doc/src/sgml/advanced.sgml @@ -237,6 +237,16 @@ COMMIT; COMMIT, and all our updates so far will be canceled. + + + A few things in the database are exempt from rollback. The most + important are SEQUENCEs - which are used by the counters in + SERIAL columns. See . Any + function or type with special transactional behavior will have an explanatory + note in its documentation. + + + PostgreSQL actually treats every SQL statement as being executed within a transaction. If you do not issue a BEGIN @@ -251,8 +261,8 @@ COMMIT; Some client libraries issue BEGIN and COMMIT commands automatically, so that you might get the effect of transaction - blocks without asking. Check the documentation for the interface - you are using. + blocks without asking. Client libraries often call this "autocommit". + Check the documentation for the interface you are using. diff --git a/doc/src/sgml/datatype.sgml b/doc/src/sgml/datatype.sgml index afc82a2..cbde801 100644 --- a/doc/src/sgml/datatype.sgml +++ b/doc/src/sgml/datatype.sgml @@ -800,7 +800,19 @@ NUMERIC bigserial are not true types, but merely a notational convenience for creating unique identifier columns (similar to the AUTO_INCREMENT property - supported by some other databases). In the current + supported by some other databases). + + + + + Because they use SEQUENCEs, serial data types are + exempt from transactional rollback. This means they can have "holes" + or gaps where values are discarded. See nexval() in + for details. + + + + In the current implementation, specifying: diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 157de09..0296d3a 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -9820,6 +9820,27 @@ nextval('foo'::text) foo is looked up at execute nextval concurrently, each will safely receive a distinct sequence value. + + + + To avoid blocking concurrent transactions that obtain numbers from the + same sequence, a nextval operation is never rolled back; + that is, once a value has been fetched it is considered used, even if the + transaction that did the nextval later aborts. This means + that aborted transactions might leave unused holes in the + sequence of assigned values. setval operations are never + rolled back, either. + + + + + If a sequence object has been created with default parameters, + successive nextval calls will return successive values + beginning with 1. Other behaviors can be obtained by using + special parameters in the command; + see its command reference page for more information. + + @@ -9883,31 +9904,17 @@ SELECT setval('foo', 42, false); Next nextval wi The result returned by setval is just the value of its second argument. + + + Changes to sequences made by setval() are not undone if the transaction + rolls back. See the note on nextval(). + + - - If a sequence object has been created with default parameters, - successive nextval calls will return successive values - beginning with 1. Other behaviors can be obtained by using - special parameters in the command; - see its command reference page for more information. - - - - - To avoid blocking concurrent transactions that obtain numbers from the - same sequence, a nextval operation is never rolled back; - that is, once a value has been fetched it is considered used, even if the - transaction that did the nextval later aborts. This means - that aborted transactions might leave unused holes in the - sequence of assigned values. setval operations are never - rolled back, either. - - -