Re: ALTER TABLE ... IF EXISTS feature?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Daniel Farina <drfarina(at)acm(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Noah Zoschke <noah(at)heroku(dot)com>
Subject: Re: ALTER TABLE ... IF EXISTS feature?
Date: 2010-11-25 00:30:56
Message-ID: 201011250030.oAP0Uuc26508@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-11-25 00:41:47 Re: duplicate connection failure messages
Previous Message Michael Glaesemann 2010-11-25 00:20:37 Re: function(contants) evaluated for every row