Re: BUG #16767: Silent dropping of CONSTRAINT... UNIQUE
От | Peter Eisentraut |
---|---|
Тема | Re: BUG #16767: Silent dropping of CONSTRAINT... UNIQUE |
Дата | |
Msg-id | 03247a85-e663-159b-c825-4334aa479fd4@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: BUG #16767: Silent dropping of CONSTRAINT... UNIQUE (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-bugs |
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.
В списке pgsql-bugs по дате отправления: