Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements
Date
Msg-id CA+Tgmoa3ib1hTg7Cd-50UwOKEPWV7iQbLLwV0j8_nV1oy9VRnw@mail.gmail.com
Whole thread Raw
In response to Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements  (Peter Eisentraut <peter_e@gmx.net>)
Re: Patch to add support of "IF NOT EXISTS" to others "CREATE" statements  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
On Wed, Jun 12, 2013 at 3:00 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On 6/12/13 1:29 PM, Fabrízio de Royes Mello wrote:
>> The attached patch add support to "IF NOT EXISTS" to "CREATE" statements
>> listed below:
>>
>> - CREATE AGGREGATE [ IF NOT EXISTS ] ...
>> - CREATE CAST [ IF NOT EXISTS ] ...
>> - CREATE COLLATION [ IF NOT EXISTS ] ...
>> - CREATE OPERATOR [ IF NOT EXISTS ] ...
>> - CREATE TEXT SEARCH {PARSER | DICTIONARY | TEMPLATE | CONFIGURATION} [
>> IF NOT EXISTS ] ...
>> - CREATE TYPE [ IF NOT EXISTS ] ... [AS [{ENUM | RANGE}] (...)]
>
> I'm wondering where "IF NOT EXISTS" and "OR REPLACE" will meet.

I kind of don't see the point of having IF NOT EXISTS for things that
have OR REPLACE, and am generally in favor of implementing OR REPLACE
rather than IF NOT EXISTS where possible.  The point is usually to get
the object to a known state, and OR REPLACE will generally accomplish
that better than IF NOT EXISTS.  However, if the object has complex
structure (like a table that contains data) then "replacing" it is a
bad plan, so IF NOT EXISTS is really the best you can do - and it's
still useful, even if it does require more care.

> Btw., I also want REPLACE BUT DO NOT CREATE.

That's a mouthful.  What's it good for?

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Re: Adding IEEE 754:2008 decimal floating point and hardware support for it
Next
From: Dmitriy Igrishin
Date:
Subject: Frontend/backend protocol improvements proposal (request).