Re: BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary
Date
Msg-id 3379436.1609861502@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> ALTER TABLE IF EXIST foo ADD COLUMN IF NOT EXISTS id BIGSERIAL PRIMARY KEY;
> Fails if "id" exists and is already the primary key.

Yeah, known problem.  This is fixed in v13, but the fix seemed too
invasive for a back-patch (see [1] and follow-on fixes).

            regards, tom lane

[1] https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=1281a5c90



pgsql-bugs by date:

Previous
From: Hamid Akhtar
Date:
Subject: Re: BUG #16805: "ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... PRIMARY KEY" fails if column exists and is the primary
Next
From: Tom Lane
Date:
Subject: Re: compiling error on OpenWrt