Re: drop if exists

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: drop if exists
Date: 2005-11-14 17:06:30
Message-ID: 4378C416.5060704@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


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
>
>
>

Attachment Content-Type Size
drop-if-exists.patch text/x-patch 20.3 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-11-15 02:40:52 Re: [HACKERS] Per-table freeze limit proposal
Previous Message Tom Lane 2005-11-14 15:21:50 Re: drop if exists