Determining if table exists before dropping

From: "Dwayne Miller" <dmiller(at)espgroup(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Determining if table exists before dropping
Date: 2003-03-10 16:00:22
Message-ID: 3E6CB696.2090606@espgroup.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there any way of wrapping a DROP TABLE statement within a test in a
psql script? I've constructed a script that should DROP a table if it
exists before trying to CREATE the table. I'm passing this script in as
a command from a C program using PQsendQuery(). And the first DROP
statement results in an error being returned when the TABLE does not
exist. The rest of the statements are ignored. psql processes the
script to completion even though an error is generated. I would like
the script to return an error if some other error was encountered.

Perhaps there is a way to treat this error as a warning?

Tks,
Dwayne

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2003-03-10 16:16:21 Re: [NOVICE] General Performance questions
Previous Message Tom Lane 2003-03-10 15:45:26 Re: [NOVICE] General Performance questions