Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key
Date
Msg-id 934540.1647020237@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
I wrote:
> ... The old behavior is what
> ATExecAlterColumnType wants, I judge.  As this stands, we will
> rebuild indexes that don't need to be rebuilt, and indeed might
> be on other tables altogether from the one that is being modified
> (which opens all sorts of potential locking problems).

Oh, well, not so much:

regression=# create table atref (p1 int constraint pk_atref primary key);
CREATE TABLE
regression=# create table attbl (c1 int, constraint fk_atref foreign key (c1) references atref(p1));
CREATE TABLE
regression=# cluster atref using pk_atref;
CLUSTER
regression=# alter table attbl alter column c1 set data type bigint;
ERROR:  "pk_atref" is not an index for table "attbl"

Still, that's just as unpleasant as the originally-reported case.
(I've not figured out yet why the "cluster" step is required to
make this repro work.)

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key
Next
From: Tom Lane
Date:
Subject: Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key