Re: [postgresSQL] [bug] Two or more different types of constraints with same name creates ambiguity while drooping.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Harshal Dhumal <harshal(dot)dhumal(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [postgresSQL] [bug] Two or more different types of constraints with same name creates ambiguity while drooping.
Date: 2016-03-30 16:12:08
Message-ID: 18034.1459354328@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 03/30/2016 10:21 AM, Tom Lane wrote:
>> I think that if we want to ensure uniqueness of constraint names, this
>> is really approaching it the wrong way, as it still fails to provide
>> any guarantees (consider concurrent index creation, for example).
>> What we need is a unique index on pg_constraint.

> +1, but does that mean people will have to change constraint names to be
> compliant before running pg_upgrade?

Yeah, but I think the situation is pretty uncommon, because we already
reject duplicate constraint names in most cases. As far as I could see
in testing it earlier, these cases all fail already:

* create index constraint when same-named index constraint exists already
* create FK constraint when same-named index constraint exists already
* create FK constraint when same-named FK constraint exists already
* create check constraint when same-named check constraint exists already
* create FK constraint when same-named check constraint exists already

I think that the case Amit's patch plugged, namely create index constraint
when same-named FK or check constraint exists already, may be about the
only missing check. I just want a unique index to be sure we are covering
all cases.

Note also that because pg_dump prefers to create indexes before FK
constraints (for obvious reasons), I believe that such a case would
fail to dump/restore or pg_upgrade already.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2016-03-30 16:14:03 Re: Password identifiers, protocol aging and SCRAM protocol
Previous Message Alvaro Herrera 2016-03-30 16:01:19 Re: snapshot too old, configured by time