]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix propagation of persistence to sequences in ALTER TABLE / ADD COLUMN
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 9 Feb 2024 06:57:31 +0000 (07:57 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 9 Feb 2024 07:15:27 +0000 (08:15 +0100)
commitd17a3a4c6a34f61a3d4d9faa7a70c14d8d0c0ffb
tree448c4b51e57740cc0aede21b21e8210f259df1f9
parent27c3a41f3cfbfc3ab471fd85b4885d39f7c42ae6
Fix propagation of persistence to sequences in ALTER TABLE / ADD COLUMN

Fix for 344d62fb9a9: That commit introduced unlogged sequences and
made it so that identity/serial sequences automatically get the
persistence level of their owning table.  But this works only for
CREATE TABLE and not for ALTER TABLE / ADD COLUMN.  The latter would
always create the sequence as logged (default), independent of the
persistence setting of the table.  This is fixed here.

Note: It is allowed to change the persistence of identity sequences
directly using ALTER SEQUENCE.  So mistakes in existing databases can
be fixed manually.

Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/c4b6e2ed-bcdf-4ea7-965f-e49761094827%40eisentraut.org
src/backend/parser/parse_utilcmd.c
src/test/regress/expected/identity.out
src/test/regress/sql/identity.sql