Re: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Keith Fiske <keith.fiske@crunchydata.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>, pgsql-bugs@lists.postgresql.org
Date: 2019-06-24T19:05:30Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- alter-type-final-fix-HEAD.patch (text/x-diff) patch
I wrote: > As before, I attach a patch against HEAD, plus one that assumes e76de8861 > has been reverted first, which is likely easier to review. > Unlike yesterday, I'm feeling pretty good about this patch now, but it > still wouldn't hurt for somebody else to go over it. I started to back-patch this, and soon noticed that the content of the OCLASS_CONSTRAINT case branch in ATExecAlterColumnType has varied across versions, which makes copy-and-pasting it seem pretty hazardous. Hence it seems prudent to do slightly more work and split that code out into a subroutine rather than having two copies. As attached, which is a hopefully-final patch for HEAD. As before, it presumes reversion of e76de8861, because it's a lot easier to see what's going on that way. BTW ... while working on this, I got annoyed by the fact that ATExecAlterColumnGenericOptions was inserted, no doubt with the aid of a dartboard, into the middle of a large group of AlterColumnType-related functions. Would anyone mind a separate patch to relocate it down past those, probably just before ATExecChangeOwner? regards, tom lane
Commits
-
Simplify psql \d's rule for ordering the indexes of a table.
- 4d6603f28dfc 13.0 landed
-
Purely-cosmetic adjustments in tablecmds.c.
- ccfcc8fdbd9b 12.0 landed
-
Further fix ALTER COLUMN TYPE's handling of indexes and index constraints.
- f946a409143d 12.0 landed
- ddfb1b2eeaec 9.4.24 landed
- da1041fc3a2b 9.6.15 landed
- cb8962ce8eb4 10.10 landed
- afaf48afb107 11.5 landed
- 316f68932824 9.5.19 landed
-
Fix ALTER COLUMN TYPE failure with a partial exclusion constraint.
- e76de886157b 12.0 cited