Re: BUG #16870: ADD COLUMN IF NOT EXISTS with GENERATED ALWAYS AS IDENTITY can cause duplicate sequence

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sean(at)respax(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16870: ADD COLUMN IF NOT EXISTS with GENERATED ALWAYS AS IDENTITY can cause duplicate sequence
Date: 2021-02-17 15:46:29
Message-ID: 2536806.1613576789@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> Hello, I'm getting unexpected behaviour with IDENTITY columns when running
> ALTER TABLE ADD COLUMN IF NOT EXISTS on them when they already exist.

Yeah, this is a known issue: the IF NOT EXISTS operates to skip the
actual creation of the column, but it fails to suppress secondary
operations such as adding indexes or serial sequences. It's fixed
in v13, but the changes were too major to consider back-patching.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-02-17 16:02:04 Re: BUG #16871: Insert with wrong key field, causing later crash of DB.
Previous Message PG Bug reporting form 2021-02-17 11:24:53 BUG #16871: Insert with wrong key field, causing later crash of DB.