From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: boekewurm+postgres@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16767: Silent dropping of CONSTRAINT... UNIQUE
Date: Sat, 12 Dec 2020 23:18:15 +0100
Message-ID: <03247a85-e663-159b-c825-4334aa479fd4@enterprisedb.com> (raw)
In-Reply-To: <3254991.1607446081@sss.pgh.pa.us>
References: <16767-1714a2056ca516d0@postgresql.org>
<3254991.1607446081@sss.pgh.pa.us>
On 2020-12-08 17:48, Tom Lane wrote:
> PG Bug reporting form <noreply@postgresql.org> writes:
>> I've just noticed that equivalent unique constraints that are specified in
>> the same statement only generate one constraint;
>
> Yeah, that's intentional. Per the source code comments:
>
> * Scan the index list and remove any redundant index specifications. This
> * can happen if, for instance, the user writes UNIQUE PRIMARY KEY. A
> * strict reading of SQL would suggest raising an error instead, but that
> * strikes me as too anal-retentive. - tgl 2001-02-14
It's nonetheless inconsistent that you can create redundant unique
constraints via ALTER TABLE, but doing it in CREATE TABLE results in
different behavior.
This all seems a bit dubious to me. We should either allow it or
prohibit it, not silently do something else in some cases.
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: peter.eisentraut@enterprisedb.com, tgl@sss.pgh.pa.us, boekewurm+postgres@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16767: Silent dropping of CONSTRAINT... UNIQUE
In-Reply-To: <03247a85-e663-159b-c825-4334aa479fd4@enterprisedb.com>
* 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