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

Re: Possible temp table bug in PostgreSQL 7.4.7 / 8.0.1

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Oliver Siegmar <o(dot)siegmar(at)vitrado(dot)de>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Possible temp table bug in PostgreSQL 7.4.7 / 8.0.1
Date: 2005-03-18 17:08:35
Message-ID: 200503181708.j2IH8ZA11152@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Uh, have you read the FAQ item about plpgsql and temporary tables?

---------------------------------------------------------------------------

Oliver Siegmar wrote:
> Hello,
> 
> I've probably found a temp table bug in PostgreSQL (tested with 7.4.7 and 
> 8.0.1 on Linux x86).
> 
> 
> 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
> 
> 
> No transaction has been started manually.
> 
> If I drop the temporary testtable manually within the PL/pgSQL function, 
> everything runs fine. Bug or feature? ;-)
> 
> 
> Cheers,
> Oliver
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-bugs by date

Next:From: Bruce MomjianDate: 2005-03-18 17:16:14
Subject: Re: BUG #1549: initdb doesn't work
Previous:From: Stephan SzaboDate: 2005-03-18 14:45:39
Subject: Re: BUG #1546: Temp table isn't deleted at the end of a

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