Thanks for the reply.
On Oct 26, 2004, at 4:51 PM, Jaime Casanova wrote:
> what about the Ron Johnson solution?
> if exists (select 1 from pg_tables where tablename =
>> drop table thetable
Actually, Ron gave some other possibilities, but the query above does
NOT work (and was the original source of the question). Just for
information, here is a function that I had come up with that works. It
returns 1 or 0 just as a sanity check.
create or replace function drop_if_exists (text) returns INTEGER AS '
tbl_name ALIAS FOR $1;
IF (select count(*) from pg_tables where tablename=$1) THEN EXECUTE
''DROP TABLE '' || $1;
In response to
pgsql-novice by date
|Next:||From: ishaame||Date: 2004-10-27 06:46:54|
|Subject: Cannot Create tables - on Windows XP|
|Previous:||From: Jaime Casanova||Date: 2004-10-26 20:51:34|
|Subject: Re: DROP TABLE IF EXISTS|