Skip site navigation (1) Skip section navigation (2)

Re: BUG #1546: Temp table isn't deleted at the end of a

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Oliver Siegmar <o(dot)siegmar(at)vitrado(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1546: Temp table isn't deleted at the end of a
Date: 2005-03-18 13:29:51
Message-ID: 20050318052629.H61964@megazone.bigpanda.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, 15 Mar 2005, Oliver Siegmar wrote:

> Here's a demonstration of the bug:
>
> CREATE FUNCTION testfunction()
> RETURNS void
> AS '
>     BEGIN
>         CREATE TEMP TABLE testtable (field int4) ON COMMIT DROP;
>
>         INSERT INTO testtable (field) VALUES (1);
>
>         -- DROP TABLE testtable;
>
>         RETURN;
>     END;
> ' LANGUAGE 'plpgsql';
>
>
> database=# SELECT testfunction();
>
>  testfunction
> --------------
>
> (1 row)
>
> database=# SELECT testfunction();
> ERROR:  relation with OID 29308882 does not exist
> CONTEXT:  SQL statement "INSERT INTO testtable (field) VALUES (1)"
> PL/pgSQL function "testfunction" line 4 at SQL statement

Given the error message, this seems to be the whole plpgsql caches query
plans but we don't invalidate those plans when there are schema changes.
In all currently released versions you pretty much need to use EXECUTE on
any queries where the table may go away, for example, any use of temp
tables.

In response to

Responses

pgsql-bugs by date

Next:From: Oliver SiegmarDate: 2005-03-18 13:58:59
Subject: Re: BUG #1546: Temp table isn't deleted at the end of a transaction / ON COMMIT DROP has no effect
Previous:From: Michael MeskesDate: 2005-03-18 10:01:51
Subject: Re: [INTERFACES] libecpg (8.0 and CVS) hits a gcc bug on powerpc and amd64 (crash)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group