Re: BUG #17351: Altering a composite type created for a partitioned table can lead to a crash

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: exclusion(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17351: Altering a composite type created for a partitioned table can lead to a crash
Date: 2022-01-01 21:27:05
Message-ID: 3057471.1641072425@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alexander Lakhin 2022-01-02 19:00:00 Re: BUG #17344: Assert failed on queiring async_capable foreign table with inheritance
Previous Message PG Bug reporting form 2022-01-01 18:00:01 BUG #17351: Altering a composite type created for a partitioned table can lead to a crash