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: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: keith.fiske@crunchydata.com, pgsql-bugs@lists.postgresql.org
Date: 2019-06-21T16:47:55Z
Lists: pgsql-bugs, pgsql-hackers
I wrote: > BTW, has anyone got an explanation for the order in which psql is > listing the indexes of "anothertab" in this test case? Ah, here's the explanation: describe.c is sorting the indexes with this: "ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname;" I can see the point of putting the pkey first, I guess, but the preference for uniques second seems pretty bizarre, especially since (a) it doesn't distinguish unique constraints from plain unique indexes and (b) there's no similar preference for exclusion constraints, even though those might be morally equivalent to a unique constraint. What do people think of dropping the indisunique sort column here? Obviously not back-patch material, but it might be more sensible behavior going forward. 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