pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent ALTERing a row type that's concurrently used in a column 4+ messages / 1 participants [nested] [flat]
* pgsql: Prevent ALTERing a row type that's concurrently used in a column @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent ALTERing a row type that's concurrently used in a column ALTER TABLE/TYPE checks if the type is being used in a column and forbids it, because that would require rewriting the data in the affected table. But the check missed cases where the type was concurrently used in a CREATE TABLE or ALTER TABLE ADD COLUMN that hasn't committed yet. Commit 2fbb21170e fixed a similar race condition for dropping the column type altogether, but it wasn't sufficient to fix the problem with altering the type, because altering a composite type doesn't currently lock the type. It does lock the *relation* corresponding to the type (i.e. pg_type.typrelid), but CREATE TABLE did not hold onto that lock, even though it acquires it momentarily. To fix, don't release the lock. Reviewed-by: Andres Freund <andres@anarazel.de> Security: CVE-2026-6460 Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/b4e703af02c5ad0e562516311503bf1aca66fb48 Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> Modified Files -------------- src/backend/catalog/heap.c | 7 +- src/test/isolation/expected/type-ddl-locking.out | 109 ++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/type-ddl-locking.spec | 157 +++++++++++++++++++++++ 4 files changed, 273 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Prevent ALTERing a row type that's concurrently used in a column @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent ALTERing a row type that's concurrently used in a column ALTER TABLE/TYPE checks if the type is being used in a column and forbids it, because that would require rewriting the data in the affected table. But the check missed cases where the type was concurrently used in a CREATE TABLE or ALTER TABLE ADD COLUMN that hasn't committed yet. Commit 2fbb21170e fixed a similar race condition for dropping the column type altogether, but it wasn't sufficient to fix the problem with altering the type, because altering a composite type doesn't currently lock the type. It does lock the *relation* corresponding to the type (i.e. pg_type.typrelid), but CREATE TABLE did not hold onto that lock, even though it acquires it momentarily. To fix, don't release the lock. Reviewed-by: Andres Freund <andres@anarazel.de> Security: CVE-2026-6460 Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4993b83c57144c0aedb0d7ddadf1b47177e713cf Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> Modified Files -------------- src/backend/catalog/heap.c | 7 +- src/test/isolation/expected/type-ddl-locking.out | 109 ++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/type-ddl-locking.spec | 157 +++++++++++++++++++++++ 4 files changed, 273 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Prevent ALTERing a row type that's concurrently used in a column @ 2026-11-09 14:22 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent ALTERing a row type that's concurrently used in a column ALTER TABLE/TYPE checks if the type is being used in a column and forbids it, because that would require rewriting the data in the affected table. But the check missed cases where the type was concurrently used in a CREATE TABLE or ALTER TABLE ADD COLUMN that hasn't committed yet. Commit 2fbb21170e fixed a similar race condition for dropping the column type altogether, but it wasn't sufficient to fix the problem with altering the type, because altering a composite type doesn't currently lock the type. It does lock the *relation* corresponding to the type (i.e. pg_type.typrelid), but CREATE TABLE did not hold onto that lock, even though it acquires it momentarily. To fix, don't release the lock. Reviewed-by: Andres Freund <andres@anarazel.de> Security: CVE-2026-6460 Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/26ff7cbd370e568734abe54b65a253058f979c55 Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> Modified Files -------------- src/backend/catalog/heap.c | 7 +- src/test/isolation/expected/type-ddl-locking.out | 109 ++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/type-ddl-locking.spec | 157 +++++++++++++++++++++++ 4 files changed, 273 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Prevent ALTERing a row type that's concurrently used in a column @ 2026-11-09 14:22 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent ALTERing a row type that's concurrently used in a column ALTER TABLE/TYPE checks if the type is being used in a column and forbids it, because that would require rewriting the data in the affected table. But the check missed cases where the type was concurrently used in a CREATE TABLE or ALTER TABLE ADD COLUMN that hasn't committed yet. Commit 2fbb21170e fixed a similar race condition for dropping the column type altogether, but it wasn't sufficient to fix the problem with altering the type, because altering a composite type doesn't currently lock the type. It does lock the *relation* corresponding to the type (i.e. pg_type.typrelid), but CREATE TABLE did not hold onto that lock, even though it acquires it momentarily. To fix, don't release the lock. Reviewed-by: Andres Freund <andres@anarazel.de> Security: CVE-2026-6460 Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ea00db41ce6b690d5ca8c220094b4a77fb4864b4 Author: Heikki Linnakangas <heikki.linnakangas@iki.fi> Modified Files -------------- src/backend/catalog/heap.c | 7 +- src/test/isolation/expected/type-ddl-locking.out | 109 ++++++++++++++++ src/test/isolation/isolation_schedule | 1 + src/test/isolation/specs/type-ddl-locking.spec | 157 +++++++++++++++++++++++ 4 files changed, 273 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-11-09 14:22 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-09 14:21 pgsql: Prevent ALTERing a row type that's concurrently used in a column Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Prevent ALTERing a row type that's concurrently used in a column Noah Misch <noah@leadboat.com> 2026-11-09 14:22 pgsql: Prevent ALTERing a row type that's concurrently used in a column Noah Misch <noah@leadboat.com> 2026-11-09 14:22 pgsql: Prevent ALTERing a row type that's concurrently used in a column Noah Misch <noah@leadboat.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox