[COMMITTERS] pgsql: Make ALTER SEQUENCE, including RESTART, fully transactional. - Mailing list pgsql-committers

From Andres Freund
Subject [COMMITTERS] pgsql: Make ALTER SEQUENCE, including RESTART, fully transactional.
Date
Msg-id E1dGXYM-0001wP-3i@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Make ALTER SEQUENCE, including RESTART, fully transactional.

Previously the changes to the "data" part of the sequence, i.e. the
one containing the current value, were not transactional, whereas the
definition, including minimum and maximum value were.  That leads to
odd behaviour if a schema change is rolled back, with the potential
that out-of-bound sequence values can be returned.

To avoid the issue create a new relfilenode fork whenever ALTER
SEQUENCE is executed, similar to how TRUNCATE ... RESTART IDENTITY
already is already handled.

This commit also makes ALTER SEQUENCE RESTART transactional, as it
seems to be too confusing to have some forms of ALTER SEQUENCE behave
transactionally, some forms not.  This way setval() and nextval() are
not transactional, but DDL is, which seems to make sense.

This commit also rolls back parts of the changes made in 3d092fe540
and f8dc1985f as they're now not needed anymore.

Author: Andres Freund
Discussion: https://postgr.es/m/20170522154227.nvafbsm62sjpbxvd@alap3.anarazel.de
Backpatch: Bug is in master/v10 only

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3d79013b970d4cc336c06eb77ed526b44308c03e

Modified Files
--------------
doc/src/sgml/ref/alter_sequence.sgml         |  15 ++--
src/backend/commands/sequence.c              | 123 +++++++--------------------
src/test/isolation/expected/sequence-ddl.out |  30 +++----
src/test/isolation/specs/sequence-ddl.spec   |  19 +++--
4 files changed, 65 insertions(+), 122 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: [COMMITTERS] pgsql: Always use -fPIC, not -fpic,when building shared libraries with
Next
From: Alvaro Herrera
Date:
Subject: [COMMITTERS] pgsql: Fix typo