Re: drop table if exists - Mailing list pgsql-novice

From Aarni Ruuhimäki
Subject Re: drop table if exists
Date
Msg-id 200303141417.04251.aarni.ruuhimaki@kymi.com
Whole thread Raw
In response to Re: drop table if exists  (Kevin Coyner <kevin@rustybear.com>)
List pgsql-novice
Hi !

DROP IF EXISTS is about the same as DROP ( regardless if it exists or not ) ?

pg_dump -c file does just that, i.e. use DROP, it gives an error output about
non-existent table but you can ignore that. ( 7.2.3 )

BR,


On Friday 14 March 2003 13:46, you wrote:
> On Wed, Mar 05, 2003 at 02:09:03PM -0500, Kevin Coyner wrote......
>
> > In MySQL, when I create a new table from a .sql file, I usually start
> > with:
> >
> > DROP TABLE IF EXISTS sometable;
> > CREATE TABLE sometable(
> >
> >
> > This doesn't work in Postgres and I haven't been able to find the
> > equivalent in the docs.  If I try to drop a table that doesn't exist, I
> > get an error message, so having that modifier "... if exists ..." is
> > nice.
> >
> > Is there an equivalent to "IF EXISTS" in Postgres?
>
> No thoughts about this one?
>
> Thanks
> Kevin

--
Aarni Ruuhimäki
Megative Tmi
KYMI.com

Pääsintie 26
45100 Kouvola

info@kymi.com / aarni.ruuhimaki@kymi.com

05 - 3755 035 / 050 - 4910 037

**********************
Linux RedHat / KDE
**********************



pgsql-novice by date:

Previous
From: Kevin Coyner
Date:
Subject: Re: drop table if exists
Next
From: Josh Berkus
Date:
Subject: Re: get the oid