| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Check for missing dependencies on types |
| Date: | 2026-11-09 14:22:07 |
| Message-ID: | E1xQQG7-000000003vF-0lwA@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)postgresql(dot)org>
Reviewed-by: Amit Langote <amitlangote09(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Security: CVE-2026-6460
Backpatch-through: 14
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5024810ad4615281cc63fbd6c184caa09e330465
Author: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Modified Files
--------------
src/backend/commands/tablecmds.c | 144 ++++++++++++++++++++++++
src/test/regress/expected/alter_column_type.out | 72 ++----------
src/test/regress/sql/alter_column_type.sql | 35 +-----
3 files changed, 158 insertions(+), 93 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-11-09 14:22:08 | pgsql: Handle composite type changes in ExecEvalFieldStore[De]Form |
| Previous Message | Noah Misch | 2026-11-09 14:22:06 | pgsql: dblink: Refuse to use a connection that a dblink call is already |