pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: keith.fiske@crunchydata.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
Date: Fri, 21 Jun 2019 12:47:55 -0400
Message-ID: <21081.1561135675@sss.pgh.pa.us> (raw)
In-Reply-To: <28827.1561082086@sss.pgh.pa.us>
References: <20190620204505.GA22934@alvherre.pgsql>
	<25354.1561064909@sss.pgh.pa.us>
	<905.1561076455@sss.pgh.pa.us>
	<28827.1561082086@sss.pgh.pa.us>

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





view thread (12+ messages)  latest in thread

Message-ID: <21081.1561135675@sss.pgh.pa.us>
Permalink:  ../21081.1561135675@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21081.1561135675@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, keith.fiske@crunchydata.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15865: ALTER TABLE statements causing "relation already exists" errors when some indexes exist
  In-Reply-To: <21081.1561135675@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox