Re: Question Regarding a Temporary Table

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Terry Lee Tucker <terry(at)leetuckert(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question Regarding a Temporary Table
Date: 2006-09-20 21:44:33
Message-ID: 1158788673.30652.142.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2006-09-20 at 17:29 -0400, Terry Lee Tucker wrote:
> Well, I was assuming that that the table wasn't being dropped and that was
> what was causing the error. I can see from your comments, that I was wrong on
> that asssumption. I can do this with and execute, but it's going to be a pain
> to acomplish. I wonder what good a temporary table is if you can't use the
> code which creates it twice in a row with reloading the function?
>

Well, the problem is not with temporary tables so much as the cached
plans. PL/pgSQL decides when the function is first run that the
temporary table you're using has OID 123654 (or whatever), and rather
than using the table name on the function call, it assumes that the OID
has not changed.

So, a temporary table is still useful for any situation where it doesn't
cache the query plan (like a normal query, or an EXECUTE inside
PL/pgSQL).

But yes, it is frustrating, and will hopefully be fixed in later
versions.

Regards,
Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Simon_Kelly 2006-09-20 22:35:34 Re: Table Inheritance / VARCHAR search question
Previous Message Philip Hallstrom 2006-09-20 21:38:33 Re: postgresql rising