Re: drop table if exists

From: Aarni Ruuhimäki <aarni(dot)ruuhimaki(at)kymi(dot)com>
To: Kevin Coyner <kevin(at)rustybear(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: drop table if exists
Date: 2003-03-14 12:17:04
Message-ID: 200303141417.04251.aarni.ruuhimaki@kymi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)kymi(dot)com / aarni(dot)ruuhimaki(at)kymi(dot)com

05 - 3755 035 / 050 - 4910 037

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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2003-03-14 16:59:39 Re: get the oid
Previous Message Kevin Coyner 2003-03-14 11:46:14 Re: drop table if exists