pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Forbid ALTERing column type by default when other objects depend
3+ messages / 1 participants
[nested] [flat]

* pgsql: Forbid ALTERing column type by default when other objects depend
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Forbid ALTERing column type by default when other objects depend on it

Previously, we'd allow changing the column type of a table or
composite type (ALTER COLUMN / ATTRIBUTE ... TYPE ...) even if there
are objects depending on the row type.  We only made some checks on
dependencies from relation objects, and assumed that dependencies from
other kinds of object were OK.  This commit flips the logic around to
forbid if there are any dependencies, except for relations and a few
other cases that are known to be OK.

This commit is mostly refactoring, but some cases that were previously
broken, like expressions in views, are now forbidden.  Some of the
dependencies that we continue to allow are known to be broken too --
subsequent commits will tighten them up.

The attributions and discussion links are for the whole wider issue
covered by all the related commits, not just the variants fixed by
this one commit.

Reported-by: Andrew Gierth <andrew@tao11.riddles.org.uk>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Francesco Verardi <frevadiscor89@gmail.com>
Reported-by: Hcamael <baiyjrh@gmail.com>
Reported-by: Tomer Fichman <tomer@irregular.com>
Reported-by: OpenAI Security Research Team
Reported-by: Peter Geoghegan <pg@bowt.ie>
Reported-by: Mehmet Ince @mdisec <mehmet@mehmetince.net>
Reported-by: Bryan Green <dbryan.green@gmail.com>
Reported-by: Sumedh Pathak <sumedhpathak@microsoft.com>
Reported-by: Nicholas Carlini <npc@anthropic.com>
Reported-by: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
Reported-by: Yuxiao Guo <dllggyx@outlook.com>
Reported-by: Nikhil Sontakke <nikhil@planetscale.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/CA%2BUBoq0F2ua2fQEAU3-6w0oxOgFc9BgEN4gRcchiUUZ%2BWouVrQ%40mail...
Discussion: https://www.postgresql.org/message-id/CA%2BbCEdDvsVApd%2BAADX%3D5uyj6Q5C3r5aruWNzOFaYqaFqLwE_5g%40ma...
Security: CVE-2026-6460
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0b0f5c5af11b868c15ae2f80010e351f04a6b2e5
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>

Modified Files
--------------
src/backend/commands/tablecmds.c                | 100 ++++++++++++++++++++++--
src/test/regress/expected/alter_column_type.out |  48 ++++--------
src/test/regress/expected/alter_table.out       |  18 +++++
src/test/regress/sql/alter_column_type.sql      |  28 ++-----
src/test/regress/sql/alter_table.sql            |  18 +++++
5 files changed, 153 insertions(+), 59 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Forbid ALTERing column type by default when other objects depend
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Forbid ALTERing column type by default when other objects depend on it

Previously, we'd allow changing the column type of a table or
composite type (ALTER COLUMN / ATTRIBUTE ... TYPE ...) even if there
are objects depending on the row type.  We only made some checks on
dependencies from relation objects, and assumed that dependencies from
other kinds of object were OK.  This commit flips the logic around to
forbid if there are any dependencies, except for relations and a few
other cases that are known to be OK.

This commit is mostly refactoring, but some cases that were previously
broken, like expressions in views, are now forbidden.  Some of the
dependencies that we continue to allow are known to be broken too --
subsequent commits will tighten them up.

The attributions and discussion links are for the whole wider issue
covered by all the related commits, not just the variants fixed by
this one commit.

Reported-by: Andrew Gierth <andrew@tao11.riddles.org.uk>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Francesco Verardi <frevadiscor89@gmail.com>
Reported-by: Hcamael <baiyjrh@gmail.com>
Reported-by: Tomer Fichman <tomer@irregular.com>
Reported-by: OpenAI Security Research Team
Reported-by: Peter Geoghegan <pg@bowt.ie>
Reported-by: Mehmet Ince @mdisec <mehmet@mehmetince.net>
Reported-by: Bryan Green <dbryan.green@gmail.com>
Reported-by: Sumedh Pathak <sumedhpathak@microsoft.com>
Reported-by: Nicholas Carlini <npc@anthropic.com>
Reported-by: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
Reported-by: Yuxiao Guo <dllggyx@outlook.com>
Reported-by: Nikhil Sontakke <nikhil@planetscale.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/CA%2BUBoq0F2ua2fQEAU3-6w0oxOgFc9BgEN4gRcchiUUZ%2BWouVrQ%40mail...
Discussion: https://www.postgresql.org/message-id/CA%2BbCEdDvsVApd%2BAADX%3D5uyj6Q5C3r5aruWNzOFaYqaFqLwE_5g%40ma...
Security: CVE-2026-6460
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/15cf82750d19fe6798278d6e85843d3addeded0d
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>

Modified Files
--------------
src/backend/commands/tablecmds.c                | 100 ++++++++++++++++++++++--
src/test/regress/expected/alter_column_type.out |  48 ++++--------
src/test/regress/expected/alter_table.out       |  18 +++++
src/test/regress/sql/alter_column_type.sql      |  28 ++-----
src/test/regress/sql/alter_table.sql            |  18 +++++
5 files changed, 153 insertions(+), 59 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Forbid ALTERing column type by default when other objects depend
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Forbid ALTERing column type by default when other objects depend on it

Previously, we'd allow changing the column type of a table or
composite type (ALTER COLUMN / ATTRIBUTE ... TYPE ...) even if there
are objects depending on the row type.  We only made some checks on
dependencies from relation objects, and assumed that dependencies from
other kinds of object were OK.  This commit flips the logic around to
forbid if there are any dependencies, except for relations and a few
other cases that are known to be OK.

This commit is mostly refactoring, but some cases that were previously
broken, like expressions in views, are now forbidden.  Some of the
dependencies that we continue to allow are known to be broken too --
subsequent commits will tighten them up.

The attributions and discussion links are for the whole wider issue
covered by all the related commits, not just the variants fixed by
this one commit.

Reported-by: Andrew Gierth <andrew@tao11.riddles.org.uk>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Francesco Verardi <frevadiscor89@gmail.com>
Reported-by: Hcamael <baiyjrh@gmail.com>
Reported-by: Tomer Fichman <tomer@irregular.com>
Reported-by: OpenAI Security Research Team
Reported-by: Peter Geoghegan <pg@bowt.ie>
Reported-by: Mehmet Ince @mdisec <mehmet@mehmetince.net>
Reported-by: Bryan Green <dbryan.green@gmail.com>
Reported-by: Sumedh Pathak <sumedhpathak@microsoft.com>
Reported-by: Nicholas Carlini <npc@anthropic.com>
Reported-by: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
Reported-by: Yuxiao Guo <dllggyx@outlook.com>
Reported-by: Nikhil Sontakke <nikhil@planetscale.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/CA%2BUBoq0F2ua2fQEAU3-6w0oxOgFc9BgEN4gRcchiUUZ%2BWouVrQ%40mail...
Discussion: https://www.postgresql.org/message-id/CA%2BbCEdDvsVApd%2BAADX%3D5uyj6Q5C3r5aruWNzOFaYqaFqLwE_5g%40ma...
Security: CVE-2026-6460
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1bb9942e205c9021b714f07de30b9662666d72de
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>

Modified Files
--------------
src/backend/commands/tablecmds.c                | 100 ++++++++++++++++++++++--
src/test/regress/expected/alter_column_type.out |  48 ++++--------
src/test/regress/expected/alter_table.out       |  18 +++++
src/test/regress/sql/alter_column_type.sql      |  28 ++-----
src/test/regress/sql/alter_table.sql            |  18 +++++
5 files changed, 153 insertions(+), 59 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-11-09 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:21 pgsql: Forbid ALTERing column type by default when other objects depend Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Forbid ALTERing column type by default when other objects depend Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Forbid ALTERing column type by default when other objects depend 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