Re: Problem with identity column & related sequences

From: Jeff Hoffmann <jeff(at)propertykey(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Problem with identity column & related sequences
Date: 2021-09-28 19:35:06
Message-ID: CAKL2NYPf55peEQqU9f+FeeF5vdJ-CunpEMJ8v4s4MEDF+if9qA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks. I was sort of expecting that answer but I didn't see where it
was addressed specifically. Unfortunately I'm stuck on v12 for the
time being so I guess it's back to the workaround.

On Tue, Sep 28, 2021 at 2:13 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Jeff Hoffmann <jeff(at)propertykey(dot)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

--
Jeff Hoffmann
Head Plate Spinner
PropertyKey
Office: 612-800-6444
jeff(at)propertykey(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-09-28 19:57:21 Re: statement_timeout vs DECLARE CURSOR
Previous Message Tom Lane 2021-09-28 19:13:27 Re: Problem with identity column & related sequences