Re: drop if exists - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: drop if exists
Date
Msg-id 20051015013202.GC13669@surnet.cl
Whole thread Raw
In response to drop if exists  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: drop if exists
Re: drop if exists
List pgsql-hackers
Andrew Dunstan wrote:
> 
> From time to time the suggestion crops up of allowing a DROP IF EXISTS 
> ... syntax. This seems not unreasonable, and I just spent a few minutes 
> looking at what might be involved.

What about "CREATE IF NOT EXISTS" (CINE)?  If we support DROP IF EXISTS
(DIE), is the other one going to be supported too?

How does this play with schemas?  I assume DIE drops the table in any
schema in the search path.  What if there's more than one; drop the
first one?  CINE creates the schema in the first schema in the path,
just like CREATE.

Also, DIE does not need to lock the table afterwards because it won't
exist, but CINE needs to keep a lock until transaction commit.

-- 
Alvaro Herrera                  http://www.amazon.com/gp/registry/DXLWNGRJD34
"Ninguna manada de bestias tiene una voz tan horrible como la humana" (Orual)


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: drop if exists
Next
From: Rod Taylor
Date:
Subject: Re: drop if exists