Re: drop if exists - Mailing list pgsql-hackers

From Tom Lane
Subject Re: drop if exists
Date
Msg-id 29806.1129391860@sss.pgh.pa.us
Whole thread Raw
In response to Re: drop if exists  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Rod Taylor wrote:
>> I would rather have a 'rollback or release savepoint' command which
>> would rollback to the savepoint if there was an error or release it
>> otherwise.
>> 
>> This way any command or combination of commands could be aborted or
>> continued as a group in a statically defined script.

> I don't see that they are mutually exclusive, although one could achieve 
> the effect this way.

For single-command transactions, you don't actually need either one.
Ignoring the error message from the failed DROP works fine.

If you're trying to wrap the creation of a whole schema in an outer
transaction, though, you need one or the other --- and Rod's suggestion
is definitely more flexible.

I think the main argument in favor of DROP IF EXISTS is that people
coming from MySQL are accustomed to having it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: slow IN() clause for many cases
Next
From: Tom Lane
Date:
Subject: Re: drop if exists