BUG #17435: "add column if not exists" always adds new FK on the column

Поиск
Список
Период
Сортировка
От PG Bug reporting form
Тема BUG #17435: "add column if not exists" always adds new FK on the column
Дата
Msg-id 17435-9cd1c9fedec5bfe5@postgresql.org
обсуждение исходный текст
Ответы Re: BUG #17435: "add column if not exists" always adds new FK on the column
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17435
Logged by:          Rafael Sousa
Email address:      rafmsou@gmail.com
PostgreSQL version: 12.10
Operating system:   macOS, linux
Description:

The statement below aims to add a new column CCC on table XXX and create a
FK constraint to YYY at the same time:

"alter table XXX add column if not exists CCC uuid references YYY (id);"

I checked the docs and other forum and that seems to be possible. The
problem is that we end up with multiple FKs created on column CCC when
running the statement multiple times. I would hope no FK gets created when
the column already exists, is that correct?


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