Re: drop if exists - Mailing list pgsql-patches

From Christopher Kings-Lynne
Subject Re: drop if exists
Date
Msg-id 437BDBCF.9020609@familyhealth.com.au
Whole thread Raw
In response to Re: drop if exists  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: drop if exists
List pgsql-patches
Will we get this functionality for ALL objects?

Bruce Momjian wrote:
> Removed from queue.  Andrew is committing it.
>
> ---------------------------------------------------------------------------
>
> Andrew Dunstan wrote:
>
>>OK, now it looks like this:
>>
>>andrew=# drop table blurflx;
>>ERROR:  table "blurflx" does not exist
>>andrew=# drop table if exists blurflx;
>>NOTICE:  table "blurflx" does not exist, skipping
>>DROP TABLE
>>andrew=# create table blurflx ( x text);
>>CREATE TABLE
>>andrew=# drop table if exists blurflx;
>>DROP TABLE
>>andrew=# drop table blurflx;
>>ERROR:  table "blurflx" does not exist
>>andrew=#
>>
>>revised patch attached.
>>
>>cheers
>>
>>andrew
>>
>>Tom Lane wrote:
>>
>>
>>>Andrew Dunstan <andrew@dunslane.net> writes:
>>>
>>>
>>>
>>>>andrew=# drop table blurflx;
>>>>ERROR:  table "blurflx" does not exist
>>>>andrew=# drop table if exists blurflx;
>>>>DROP TABLE
>>>>
>>>>
>>>
>>>If I read MySQL's documentation correctly, they emit a NOTE (equivalent
>>>of a NOTICE message I suppose) when IF EXISTS does nothing because the
>>>table doesn't exist.  Seems like we should do likewise --- your second
>>>example here seems actively misleading.  That is, I'd rather see
>>>
>>>andrew=# drop table if exists blurflx;
>>>NOTICE:  table "blurflx" does not exist, skipping
>>>DROP TABLE
>>>
>>>
>>>            regards, tom lane
>>>
>>>
>>>
>
>
>
>>---------------------------(end of broadcast)---------------------------
>>TIP 4: Have you searched our list archives?
>>
>>               http://archives.postgresql.org
>
>


pgsql-patches by date:

Previous
From: Philip Yarra
Date:
Subject: Re: pl/pgSQL doco patch
Next
From: "Andrew Dunstan"
Date:
Subject: Re: drop if exists