Re: BUG #15710: ADD COLUMN IF NOT EXISTS adds constraint anyways

Поиск
Список
Период
Сортировка
От Christoph Berg
Тема Re: BUG #15710: ADD COLUMN IF NOT EXISTS adds constraint anyways
Дата
Msg-id 20190322083614.GA32388@msg.df7cb.de
обсуждение исходный текст
Ответ на BUG #15710: ADD COLUMN IF NOT EXISTS adds constraint anyways  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
Re: PG Bug reporting form 2019-03-21 <15710-f52bad04543be4cb@postgresql.org>
> CREATE TABLE test (id SERIAL PRIMARY KEY);
> ALTER TABLE test ADD COLUMN IF NOT EXISTS new_column integer UNIQUE;

As a workaround, you can name the constraint:

ALTER TABLE test ADD COLUMN IF NOT EXISTS new_column integer CONSTRAINT id_unique UNIQUE;

Then it won't get added multiple times. (It will still be executed
once, though.)

Christoph


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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: BUG #15668: Server crash in transformPartitionRangeBounds
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: BUG #15708: RLS 'using' running as wrong user when called from a view