Re: ALTER TABLE ... IF EXISTS feature? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: ALTER TABLE ... IF EXISTS feature?
Date
Msg-id 201011250030.oAP0Uuc26508@momjian.us
Whole thread Raw
In response to Re: ALTER TABLE ... IF EXISTS feature?  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: ALTER TABLE ... IF EXISTS feature?
List pgsql-hackers
Robert Haas wrote:
> With respect to the syntax itself, I have mixed feelings.  On the one
> hand, I'm a big fan of CREATE IF NOT EXISTS and DROP IF EXISTS
> precisely because I believe they handle many common cases that people
> want in real life without much hullabaloo.  But, there's clearly some
> limit to what can reasonably be done this way.  At some point, what
> you really want is some kind of meta-language where you can write
> things like:
> 
> IF EXISTS TABLE t1 THEN
>    ALTER TABLE t1 DROP CONSTRAINT IF EXISTS t1_constr;
> END IF;

FYI, I have felt this way for a while.  IF EXISTS seemed like something
that should never have been added as an inline SQL command option; it
just crept in, and kept growing.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + It's impossible for everything to be true. +


pgsql-hackers by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: function(contants) evaluated for every row
Next
From: Alvaro Herrera
Date:
Subject: Re: duplicate connection failure messages