pgsql: Prevent altering partitioned table's rowtype, if it's used elsew

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Prevent altering partitioned table's rowtype, if it's used elsew
Date: 2022-01-06 21:47:13
Message-ID: E1n5abJ-0004No-VN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Prevent altering partitioned table's rowtype, if it's used elsewhere.

We disallow altering a column datatype within a regular table,
if the table's rowtype is used as a column type elsewhere,
because we lack code to go around and rewrite the other tables.
This restriction should apply to partitioned tables as well, but it
was not checked because ATRewriteTables and ATPrepAlterColumnType
were not on the same page about who should do it for which relkinds.

Per bug #17351 from Alexander Lakhin. Back-patch to all supported
branches.

Discussion: https://postgr.es/m/17351-6db1870f3f4f612a@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7ead9925ff94cfc9c3237672b7d19d5cc1b27ef5

Modified Files
--------------
src/backend/commands/tablecmds.c | 7 +++----
src/test/regress/expected/alter_table.out | 23 ++++++++++++++++++-----
src/test/regress/sql/alter_table.sql | 19 +++++++++++++++----
3 files changed, 36 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-01-06 21:47:14 pgsql: Prevent altering partitioned table's rowtype, if it's used elsew
Previous Message Tom Lane 2022-01-06 18:09:18 pgsql: Extend psql's \lo_list/\dl to be able to print large objects' AC