From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, olav(at)backupbay(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #15180: Alter table add column if not exists with unique constraint will add extra duplicate |
Date: | 2018-05-01 19:24:27 |
Message-ID: | CAKFQuwaKr8fH3y6ermzKQdE+32UosuuGWmz5w=y2NXYfcWGMRQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, May 1, 2018 at 11:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> A possible objection to this design is that right now, you can do
>
> alter table foo
> add column if not exists f2 text,
> add column if not exists f2 int;
>
> and it will skip the second ADD subcommand because by that point the
> column exists. With this design, both test subcommands would find that
> f2 doesn't exist so we'd try to do both ADD subcommands, and the second
> one would fail. That doesn't particularly bother me, because this
> command is silly.
I'd argue its probably not that silly when you consider copy-paste errors
- in which case actually failing instead of silently ignoring the second
instance of the same name would be looked upon favorably by the user. And
since pg_dump isn't going to be affected by this the new error seems more
positive than negative on-the-whole.
As with the serial thread I'm definitely +1 for making this behave in a
less surprising manner - and Tom's proposed flow seems to me to match the
expected behavior (I agree with Stephen here, I think I got bogged down in
the sequence aspects of the previous thread when having it be this simple
is preferable).
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2018-05-01 19:44:22 | Re: power() function in Windows: "value out of range: underflow" |
Previous Message | Robert Haas | 2018-05-01 19:08:46 | Re: power() function in Windows: "value out of range: underflow" |