Re: drop if exists

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: 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-16 16:38:14
Message-ID: 200511161638.jAGGcEr17235@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


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

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2005-11-16 17:13:49 Numeric 508 datatype
Previous Message Andrew Dunstan 2005-11-16 14:40:37 Re: [PATCHES] pl/pgSQL doco patch