Re: Drop temporary table only if it exists - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Drop temporary table only if it exists
Date
Msg-id 200302181028.01599.josh@agliodbs.com
Whole thread Raw
In response to Re: Drop temporary table only if it exists  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-sql
Jan,

> > How do I drop a temporary table ( or for that matter a sequence) only
> > if it exists  or create them if they donot exist ? I want to do this
> > to avoid any errors
>
> I wonder what type of application cannot remember if it created a temp
> object or not during the lifetime of it's database connection.

A real one, Jan.

This sort of test is particularly necessary for Exception handling routines.
One wants the exception handler to drop all temporary obejcts for a clean
slate, but since an exception has occurred, one cannot be sure which objects
were created successfully.

I've personally written several such routines.

--
-Josh BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: "Martin Davidsson"
Date:
Subject: Rule Creates Duplicates retry
Next
From: Jeff Eckermann
Date:
Subject: Re: trigger after with cursor