Re: conditional dropping of columns/constraints

From: Andres Freund <andres(at)anarazel(dot)de>
To: Chris Browne <cbbrowne(at)acm(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: conditional dropping of columns/constraints
Date: 2009-05-05 13:19:50
Message-ID: 4A003CF6.8030900@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Chris,

On 05/04/2009 09:21 PM, Chris Browne wrote:
> robertmhaas(at)gmail(dot)com (Robert Haas) writes:
>> On Mon, May 4, 2009 at 10:10 AM, Andres Freund<andres(at)anarazel(dot)de> wrote:
>>> Would a patch adding 'IF EXISTS' support to:
>>> - ALTER TABLE ... DROP COLUMN
>>> - ALTER TABLE ... DROP CONSTRAINT
>>> possibly be accepted?
>> Can't speak for the committers, but I've wished for this a time or two myself.
> For constraints, it's easy enough to treat that as idempotent; it's no
> big deal to drop and re-add a constraint.
>
> For columns, I'd *much* more frequently be interested in
> ALTER TABLE ... ADD COLUMN IF NOT EXISTS ...
>
> Note that this is distinctly NOT the same as:
> ALTER TABLE ... DROP COLUMN IF EXISTS ...
> ALTER TABLE ... ADD COLUMN ...
Yes, I would like to have that myself - but this seems to open a way
much bigger can of worms.
Also the problem solved by both suggestions are not completely congruent
- so I thought better tackle the easier one first before starting a long
and arduous discussion...

Andres

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-05-05 14:00:37 Re: bytea vs. pg_dump
Previous Message Andrew Dunstan 2009-05-05 12:56:09 Re: conditional dropping of columns/constraints