Re: drop if exists

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: drop if exists
Date: 2005-10-15 01:32:02
Message-ID: 20051015013202.GC13669@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2005-10-15 01:32:21 Re: drop if exists
Previous Message David Fetter 2005-10-15 00:47:48 Re: drop if exists