Re: drop if exists

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Rod Taylor <pg(at)rbt(dot)ca>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: drop if exists
Date: 2005-10-15 15:57:40
Message-ID: 29806.1129391860@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-15 16:04:50 Re: drop if exists
Previous Message Tom Lane 2005-10-15 15:31:32 Re: slow IN() clause for many cases