On Nov 16, 2004, at 2:11 PM, Michael Fuhr wrote:
\set VERBOSITY verbose
SELECT foo();
ERROR: 42P01: table "my_temp" does not exist
CONTEXT: SQL statement "DROP TABLE my_temp"
PL/pgSQL function "foo" line 2 at SQL statement
LOCATION: DropErrorMsgNonExistent, utility.c:144
The error code is 42P01,
On Tue, Nov 16, 2004 at 01:39:45PM -0600, Timothy Perrigo wrote:
> begin
> execute 'drop table my_temp';
> exception
> -- do nothing
> end;
>
> That didn't work; apparently the "WHEN" condition is necessary. What
> condition should I be trapping for?
I assume you're using one of the 8.0 betas;
I'm working on a plpgsql function that creates and populates a
temporary table. I would like the function to first drop the temp
table, if it already exists. I'm not sure how to accomplish this,
though. My first inclination was to simply wrap the 'drop table'
command in an exception handling