BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary
| От | PG Bug reporting form |
|---|---|
| Тема | BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary |
| Дата | |
| Msg-id | 16805-4e3f8b42fbe7622c@postgresql.org обсуждение исходный текст |
| Ответы |
Re: BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary
Re: BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary |
| Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 16805 Logged by: Doug Perham Email address: dperham@opex.com PostgreSQL version: 12.5 Operating system: Ubuntu 20.04 Description: ALTER TABLE IF EXIST foo ADD COLUMN IF NOT EXISTS id BIGSERIAL PRIMARY KEY; Fails if "id" exists and is already the primary key. It seems that everything should be okay if "id" exists and is the primary key. Instead, an error is thrown as follows: test=# create table foo ( bar text ); CREATE TABLE test=# alter table if exists foo add column if not exists id bigserial primary key; ALTER TABLE test=# alter table if exists foo add column if not exists id bigserial primary key; NOTICE: column "id" of relation "foo" already exists, skipping ERROR: multiple primary keys for table "foo" are not allowed
В списке pgsql-bugs по дате отправления: