BUG #15981: Alter table add column if not exists with constraint fails on constraint

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: e(dot)oneal89(at)gmail(dot)com
Subject: BUG #15981: Alter table add column if not exists with constraint fails on constraint
Date: 2019-08-27 15:07:01
Message-ID: 15981-1c21384db6d3e7f1@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15981
Logged by: Erika ONeal
Email address: e(dot)oneal89(at)gmail(dot)com
PostgreSQL version: 11.5
Operating system: Debian
Description:

SQL to reproduce:

`CREATE TABLE test(id uuid PRIMARY KEY);
ALTER TABLE test ADD IF NOT EXISTS id uuid PRIMARY KEY;`

Output: `NOTICE: column "id" of relation "test" already exists, skipping
ERROR: multiple primary keys for table "test" are not allowed`

Expected Outcome: If the column already exists, it should not attempt to
index it with the column constraint. Or if that is the correct behavior, the
documentation does not reflect that.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-08-27 15:33:21 Re: BUG #15981: Alter table add column if not exists with constraint fails on constraint
Previous Message Matt Wise 2019-08-27 14:40:30 Re: BUG #15959: 'DROP EXTENSION pglogical' while an unused logical replication slot exists causes slot corruption