Re: BUG #15180: Alter table add column if not exists with unique constraint will add extra duplicate

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #15180: Alter table add column if not exists with unique constraint will add extra duplicate
Дата
Msg-id 19456.1525186012@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #15180: Alter table add column if not exists with uniqueconstraint will add extra duplicate  (Stephen Frost <sfrost@snowman.net>)
Ответы Re: BUG #15180: Alter table add column if not exists with uniqueconstraint will add extra duplicate  (Stephen Frost <sfrost@snowman.net>)
Список pgsql-bugs
Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> I'll spare you my usual rant about how CREATE IF NOT EXISTS sucks because
>> the subsequent state of the object isn't well-defined ... oops, too late.
>> But this seems like just another case of that problem.

> My understanding, and, it seems, that of the original poster and likely
> anyone who works with PG, is that an IF NOT EXISTS means "only perform
> this operation if the thing doesn't already exist.

Not clear.  If the column exists but there's no unique index on it,
should this command cause the index to spring into existence?
C.I.N.E. is by its nature too fuzzy to allow any principled answer to
that.  The facts on the ground are that right now, this does result in
creation of an index.  If we take that away, I guarantee you somebody
else will file a bug report complaining that it used to work and we
broke their code.

            regards, tom lane


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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: BUG #15180: Alter table add column if not exists with uniqueconstraint will add extra duplicate
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: BUG #15180: Alter table add column if not exists with uniqueconstraint will add extra duplicate