Re: Two constraints with the same name not always allowed

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: Two constraints with the same name not always allowed
Дата
Msg-id 87in3ovy0r.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Two constraints with the same name not always allowed  (André Hänsel <andre@webkr.de>)
Ответы Re: Two constraints with the same name not always allowed
Список pgsql-bugs
>>>>> "André" == André Hänsel <andre@webkr.de> writes:

 André> Case 2:

 André> CREATE TABLE t(c integer);
 André> ALTER TABLE t ADD CONSTRAINT foo CHECK(c > 1);
 André> ALTER TABLE t ADD CONSTRAINT foo UNIQUE(c);

 André>  -> Creates two constraints, both called "foo".

I'd call _that_ a bug, myself - having two constraints on a table with
the same name potentially messes up a lot of automated maintenance
operations.

 André> In cases where two constraints with the same name are created,
 André> an "ALTER TABLE t DROP CONSTRAINT ..." drops the UNIQUE first.
 André> Issuing the ALTER TABLE a second time then drops the CHECK.

I think that's purely an artifact of what order an index scan on
pg_constraint_conrelid_index finds the constraints.

--
Andrew (irc:RhodiumToad)


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: BUG #15361: Add column if not exists create duplicate constraint
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #15361: Add column if not exists create duplicate constraint