pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alfred R. Fuller <alfred.fuller@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Bug with "CHECK" when part of ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... CHECK ...
Date: Tue, 24 Sep 2019 16:27:22 -0400
Message-ID: <1311.1569356842@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMESm9+SEO6ZNUNMh7+dkko_TiksOQC2_0hFeM0gBE8Fk3k7kA@mail.gmail.com>
References: <CAMESm9+SEO6ZNUNMh7+dkko_TiksOQC2_0hFeM0gBE8Fk3k7kA@mail.gmail.com>

"Alfred R. Fuller" <alfred.fuller@gmail.com> writes:
> Expected behavior:
> If the column exists nothing is altered.
> Actual behavior:
> The check is always added regardless if the column exists or not.

Yeah, this is yet another variant of the theme that ADD COLUMN IF EXISTS
only conditionalizes the creation of the column proper, and not other
subsidiary subcommands such as adding indexes or constraints.  I've been
poking at a fix [1], and hopefully we'll get it dealt with in v13, but
for sure it'll be a bigger change than we'd risk back-patching.

			regards, tom lane

[1] https://www.postgresql.org/message-id/flat/10365.1558909428@sss.pgh.pa.us





view thread (5+ messages)  latest in thread

Message-ID: <1311.1569356842@sss.pgh.pa.us>
Permalink:  ../1311.1569356842@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1311.1569356842@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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alfred.fuller@gmail.com
  Subject: Re: Bug with "CHECK" when part of ALTER TABLE ... ADD COLUMN IF NOT EXISTS ... CHECK ...
  In-Reply-To: <1311.1569356842@sss.pgh.pa.us>
  References: <CAMESm9+SEO6ZNUNMh7+dkko_TiksOQC2_0hFeM0gBE8Fk3k7kA@mail.gmail.com> <1311.1569356842@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