From: | Jan Wieck <JanWieck(at)Yahoo(dot)com> |
---|---|
To: | josh(at)agliodbs(dot)com |
Cc: | Mintoo Lall <tlqmail(at)yahoo(dot)com>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Drop temporary table only if it exists |
Date: | 2003-02-18 20:47:44 |
Message-ID: | 3E529BF0.D373AA9C@Yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Josh Berkus wrote:
>
> 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.
All temporary objects that need to persist across transactions should be
created at session start. Everything else is created inside the
transaction that needs it and is therefore automatically cleaned up.
If there are gazillions of those session level temporary objects, I
doubt that the database is really the right place to "cache" this sort
of data.
>
> I've personally written several such routines.
I never needed to. I might when I come around and create the next
generation of PL that supports packages with package initialization
functions and the like. Let's see ...
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #
From | Date | Subject | |
---|---|---|---|
Next Message | JBJ | 2003-02-18 23:13:04 | once again, sorting with Unicode |
Previous Message | Jeff Eckermann | 2003-02-18 20:21:44 | Re: trigger after with cursor |