Re: [External] Re: BUG #17409: Unable to alter data type of clustered column which is referenced by foreign key
Holly Roberts <holly.roberts@starlingbank.com>
From: Holly Roberts <holly.roberts@starlingbank.com>
To: Japin Li <japinli@hotmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2022-03-10T14:35:34Z
Lists: pgsql-bugs
Hello, Thanks for looking into this issue and coming up with a patch. Has any further progress been made on getting this into 14 stable? Apologies if I have missed anything. Many thanks, Holly Roberts On Fri, 18 Feb 2022 at 09:54, Japin Li <japinli@hotmail.com> wrote: > > On Fri, 18 Feb 2022 at 12:27, Michael Paquier <michael@paquier.xyz> wrote: > > On Fri, Feb 18, 2022 at 01:30:46AM +0800, Japin Li wrote: > > Reusing the test case at the top of the thread, this can also be > > triggered for replica identities, as of the code just at the top of > > what you have patched. See for example: > > CREATE TABLE parent ( > > parent_field INTEGER CONSTRAINT pk_parent PRIMARY KEY); > > ALTER TABLE parent REPLICA IDENTITY USING INDEX pk_parent; > > CREATE TABLE child ( > > child_field INTEGER, > > CONSTRAINT fk_child FOREIGN KEY (child_field) REFERENCES parent > (parent_field)); > > -- error here > > ALTER TABLE parent ALTER COLUMN parent_field SET DATA TYPE BIGINT; > > > > We surely should have test cases for all that. > > > > Anyway, I'd need to think more about your suggestion, but is that > > actually the best thing we can do? In this case, we'd attempt to > > register twice an index to rebuild within > > RememberIndexForRebuilding(), for the same relation, but there is no > > need to do so. Shouldn't we try instead to do a better job at > > scanning the pg_depend entries in ATExecAlterColumnType() and avoid > > the risk to do the same job twice? That would take care of the > > replica identity case that I have just mentioned, and of the clustered > > index case reported upthread. > > > Attach a new patch to fix the replica identify case, also add test cases. > > -- > Regrads, > Japin Li. > ChengDu WenWu Information Technology Co.,Ltd. >
Commits
-
Restore the previous semantics of get_constraint_index().
- 641f3dffcdf1 15.0 landed
- 8dcd1c3564f0 14.3 landed
-
Change get_constraint_index() to use pg_constraint.conindid
- 8b069ef5dca9 14.0 cited