Re: Drop temporary table only if it exists

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>, Mintoo Lall <tlqmail(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Drop temporary table only if it exists
Date: 2003-02-18 18:28:01
Message-ID: 200302181028.01599.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2003-02-18 20:20:26 Re: Trigger that will execute external program
Previous Message Martin Davidsson 2003-02-18 17:57:12 Rule Creates Duplicates retry