![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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? |
#3
| |||
| |||
|
|
\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, which Appendix A shows as UNDEFINED TABLE. The exception-handling block would therefore be: BEGIN DROP TABLE my_temp; EXCEPTION WHEN undefined_table THEN NULL; END; -- Michael Fuhr http://www.fuhr.org/~mfuhr/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |