Re: Problem with identity column & related sequences - Mailing list pgsql-general

From Tom Lane
Subject Re: Problem with identity column & related sequences
Date
Msg-id 2870866.1632856407@sss.pgh.pa.us
Whole thread Raw
In response to Problem with identity column & related sequences  (Jeff Hoffmann <jeff@propertykey.com>)
Responses Re: Problem with identity column & related sequences  (Jeff Hoffmann <jeff@propertykey.com>)
List pgsql-general
Jeff Hoffmann <jeff@propertykey.com> writes:
> I am using postgresql-12.8.  I am using I am making use of an identity
> column for part of a scripts to process some updated data.  Because of
> the way the script is called I don't necessarily know if this column
> is going to exist in the table I am working on so I have a step that
> will conditionally create the column if it doesn't already exist, i.e.

> alter table mytable add column if not exists unique_id integer
> generated always as identity;

You're right, this sort of thing does not work very well in v12 and
before.  We fixed it in v13, but the changes seemed far too invasive
to risk a back-patch [1].

            regards, tom lane

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



pgsql-general by date:

Previous
From: Jeff Hoffmann
Date:
Subject: Problem with identity column & related sequences
Next
From: Jeff Hoffmann
Date:
Subject: Re: Problem with identity column & related sequences