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

BUG #1546: Temp table isn't deleted at the end of a transaction / ON COMMIT DROP has no effect

From: "Oliver Siegmar" <o(dot)siegmar(at)vitrado(dot)de>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1546: Temp table isn't deleted at the end of a transaction / ON COMMIT DROP has no effect
Date: 2005-03-15 07:50:03
Message-ID: 20050315075003.5B6A6F1552@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1546
Logged by:          Oliver Siegmar
Email address:      o(dot)siegmar(at)vitrado(dot)de
PostgreSQL version: 7.4.7 / 8.0.1
Operating system:   Linux x86
Description:        Temp table isn't deleted at the end of a transaction /
ON COMMIT DROP has no effect
Details: 

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

Responses

pgsql-bugs by date

Next:From: Ales VojacekDate: 2005-03-15 07:59:31
Subject: Problem with restore DB
Previous:From: Jason EricksonDate: 2005-03-15 05:53:12
Subject: BUG #1545: LIBPQ Windows Version not calling WSACleanup for every WSAStartup

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