| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Prevent ALTERing a row type that's concurrently used in a column |
| Date: | 2026-11-09 14:21:50 |
| Message-ID: | E1xQQFq-000000003LO-2XQI@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)anarazel(dot)de>
Security: CVE-2026-6460
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b4e703af02c5ad0e562516311503bf1aca66fb48
Author: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-11-09 14:21:51 | pgsql: Close portals at end of trigger functions with transition tables |
| Previous Message | Noah Misch | 2026-11-09 14:21:49 | pgsql: Reject more unsafe names in extension script substitutions. |