Skip site navigation (1) Skip section navigation (2)

Re: drop if exists

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,"Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: drop if exists
Date: 2005-11-17 01:24:31
Message-ID: 437BDBCF.9020609@familyhealth.com.au (view raw or flat)
Thread:
Lists: 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(at)dunslane(dot)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
> 
> 


In response to

Responses

pgsql-patches by date

Next:From: Andrew DunstanDate: 2005-11-17 02:34:08
Subject: Re: drop if exists
Previous:From: Philip YarraDate: 2005-11-16 22:26:55
Subject: Re: [PATCHES] pl/pgSQL doco patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group