pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeff Hoffmann <jeff@propertykey.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Problem with identity column & related sequences
Date: Tue, 28 Sep 2021 15:13:27 -0400
Message-ID: <2870866.1632856407@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKL2NYMWJLA-9Qfx-S_-CdsnHQ8-brCQQi1a8hOjSDX8cU9nsw@mail.gmail.com>
References: <CAKL2NYMWJLA-9Qfx-S_-CdsnHQ8-brCQQi1a8hOjSDX8cU9nsw@mail.gmail.com>

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





view thread (3+ messages)  latest in thread

Message-ID: <2870866.1632856407@sss.pgh.pa.us>
Permalink:  ../2870866.1632856407@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2870866.1632856407@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jeff@propertykey.com
  Subject: Re: Problem with identity column & related sequences
  In-Reply-To: <2870866.1632856407@sss.pgh.pa.us>
  References: <CAKL2NYMWJLA-9Qfx-S_-CdsnHQ8-brCQQi1a8hOjSDX8cU9nsw@mail.gmail.com> <2870866.1632856407@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox