exclude constraints with same name?

Поиск
Список
Период
Сортировка
От A.M.
Тема exclude constraints with same name?
Дата
Msg-id 513350EF-1BE8-4C8E-828A-375BF1DFFDF3@themactionfaction.com
обсуждение исходный текст
Ответы Re: exclude constraints with same name?  (Jeff Davis <pgsql@j-davis.com>)
Список pgsql-general
I found some surprising behavior with the new EXCLUDE constraint in 9.0.0- it seems that EXCLUDE constraint names have
tobe unique across tables: 

test=# BEGIN;
BEGIN
test=# CREATE TABLE a(a INTEGER);
CREATE TABLE
test=# CREATE TABLE b(b INTEGER);
CREATE TABLE
test=# ALTER TABLE a ADD CONSTRAINT testo1 CHECK(a=1);
ALTER TABLE
test=# ALTER TABLE b ADD CONSTRAINT testo1 CHECK(b=1);
ALTER TABLE
test=# ALTER TABLE a ADD CONSTRAINT testo2 EXCLUDE (a WITH =);
NOTICE:  ALTER TABLE / ADD EXCLUDE will create implicit index "testo2" for table "a"
ALTER TABLE
test=# ALTER TABLE b ADD CONSTRAINT testo2 EXCLUDE (b WITH =);
NOTICE:  ALTER TABLE / ADD EXCLUDE will create implicit index "testo2" for table "b"
ERROR:  relation "testo2" already exists
test=#

Also, the error message is odd and could be improved. The workaround is to use unique constraint names, but I would
liketo better understand why they need to be unique in the first place when other constraint names need not be. 

Cheers,
M

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

Предыдущее
От: Leif Biberg Kristensen
Дата:
Сообщение: Re: Trade Study on Oracle vs. PostgreSQL
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: pg 8.4 crashing.