Re: BUG #17351: Altering a composite type created for a partitioned table can lead to a crash
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: exclusion@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Date: 2022-01-01T21:27:05Z
Lists: pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes: > When executing the following queries: > create table pt (a int, b int) partition by list (b); > create table t(a pt, check (a = '(1, 2)'::pt)); > alter table pt alter column a type char(4); > \d+ t > The server crashes with the following stack: Hmm. We really ought to reject the ALTER TABLE. We do if "pt" is a plain table: regression=# create table pt (a int, b int); CREATE TABLE regression=# create table t(a pt); CREATE TABLE regression=# alter table pt alter column a type char(4); ERROR: cannot alter table "pt" because column "t.a" uses its row type So something is mistakenly skipping that check for partitioned tables. I think we're also failing to worry about the rowtype of the constant in t's check constraint; it seems like that has to be complained of as well, even if the underyling columns aren't of type "pt". regards, tom lane
Commits
-
Prevent altering partitioned table's rowtype, if it's used elsewhere.
- f285d95839e0 14.2 landed
- e5b044c84e8a 10.20 landed
- ccc7c3ad86b6 12.10 landed
- 86d4bbb56a8a 13.6 landed
- 7ead9925ff94 15.0 landed
- 2ce113a4f085 11.15 landed