]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Prevent altering partitioned table's rowtype, if it's used elsewhere.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 6 Jan 2022 21:46:46 +0000 (16:46 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 6 Jan 2022 21:46:46 +0000 (16:46 -0500)
commitf285d95839e05608ee99dba399abe860d3c026c5
tree958aec73b6e6b2eba46e1a80b4dda87263435650
parent9ae0a4c702324110dde366f9370f9b6c02b4dee8
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
src/backend/commands/tablecmds.c
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql