dbTalk Databases Forums  

[BUGS] Possible temp table bug in PostgreSQL 7.4.7 / 8.0.1

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] Possible temp table bug in PostgreSQL 7.4.7 / 8.0.1 in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Oliver Siegmar
 
Posts: n/a

Default [BUGS] Possible temp table bug in PostgreSQL 7.4.7 / 8.0.1 - 03-17-2005 , 11:25 PM






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

Reply With Quote
  #2  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] Possible temp table bug in PostgreSQL 7.4.7 / 8.0.1 - 03-18-2005 , 11:12 AM







Uh, have you read the FAQ item about plpgsql and temporary tables?

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

Oliver Siegmar wrote:
Quote:
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.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.