Re: DROP TABLE IF EXISTS - Mailing list pgsql-novice

From Jaime Casanova
Subject Re: DROP TABLE IF EXISTS
Date
Msg-id 20041026205134.34093.qmail@web50004.mail.yahoo.com
Whole thread Raw
In response to Re: DROP TABLE IF EXISTS  (William Yu <wyu@talisys.com>)
Responses Re: DROP TABLE IF EXISTS
List pgsql-novice
 --- William Yu <wyu@talisys.com> escribió:
> I'm not sure why this even matters. You do DROP
> TABLE on a table that
> doesn't exist, all that will happen is that you will
> get an error back
> but your program will continue on it's merry way
> anyways. The only thing
> IF EXISTS would give you is the suppression of the
> error message.
>
>
> Steven Klassen wrote:
>
> > * Sean Davis <sdavis2@mail.nih.gov> [2004-10-21
> 12:26:47 -0400]:
> >
> >
> >>I am wondering how to do this simple mysql task in
> postgres.  Any
> >>hints?
> >
> >
> > This reply from Ron Johnson seems to suffice:
> >
> >
>
http://archives.postgresql.org/pgsql-interfaces/2002-05/msg00102.php


what about the Ron Johnson solution?
 if exists (select 1 from pg_tables where tablename =
"thetable")
> drop table thetable

regards,
Jaime Casanova

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

pgsql-novice by date:

Previous
From: "Vishal Kashyap @ [Sai Hertz And Control Systems]"
Date:
Subject: Re: Function error
Next
From: Sean Davis
Date:
Subject: Re: DROP TABLE IF EXISTS