From: Christoph Berg <myon@debian.org>
To: thomas@palan.at
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15710: ADD COLUMN IF NOT EXISTS adds constraint anyways
Date: Fri, 22 Mar 2019 09:36:14 +0100
Message-ID: <20190322083614.GA32388@msg.df7cb.de> (raw)
In-Reply-To: <15710-f52bad04543be4cb@postgresql.org>
References: <15710-f52bad04543be4cb@postgresql.org>
Re: PG Bug reporting form 2019-03-21 <15710-f52bad04543be4cb@postgresql.org>
> CREATE TABLE test (id SERIAL PRIMARY KEY);
> ALTER TABLE test ADD COLUMN IF NOT EXISTS new_column integer UNIQUE;
As a workaround, you can name the constraint:
ALTER TABLE test ADD COLUMN IF NOT EXISTS new_column integer CONSTRAINT id_unique UNIQUE;
Then it won't get added multiple times. (It will still be executed
once, though.)
Christoph
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: myon@debian.org, thomas@palan.at, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15710: ADD COLUMN IF NOT EXISTS adds constraint anyways
In-Reply-To: <20190322083614.GA32388@msg.df7cb.de>
* 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