From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Check for missing dependencies on types
Date: Mon, 09 Nov 2026 14:21:50 +0000
Message-ID: <E1xQQFq-000000003LB-2CQ0@gemulon.postgresql.org> (raw)
Check for missing dependencies on types
If an expression that's stored in a catalog references a rowtype in a
way that would break ALTERing its attribute, we record a dependency on
the type, and find_composite_type_dependencies() prevents ALTERing it.
However, we have failed to record the dependency in some cases, namely
if the expression itself doesn't depend on the type in an incompatible
way, but produces a *result* of the given datatype which is stored.
That problem arises from index expressions, PARTITION BY expressions,
and from expression statistics.
To fix, scan the pg_index, pg_partitioned_table and pg_statistic_ext
catalogs for those cases as a separate sub-step of
find_composite_type_dependencies(). In the future, after we have
added the missing dependency creation and backfilled any existing
missing dependencies, we can remove this code. That means, in a new
major version.
For all reporters and public discussions, see previous commits.
Co-authored-by: Nathan Bossart <nathan@postgresql.org>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Security: CVE-2026-6460
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ac460a144ac2e602241e39f2ea2e16e307af6f54
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Modified Files
--------------
src/backend/commands/tablecmds.c | 138 ++++++++++++++++++++++++
src/test/regress/expected/alter_column_type.out | 72 +++----------
src/test/regress/sql/alter_column_type.sql | 35 +-----
3 files changed, 152 insertions(+), 93 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: noah@leadboat.com
Subject: Re: pgsql: Check for missing dependencies on types
In-Reply-To: <E1xQQFq-000000003LB-2CQ0@gemulon.postgresql.org>
References: <E1xQQFq-000000003LB-2CQ0@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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