============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================
Your name : Maarten Hazewinkel
Your email address : hazewinkel@bortiboll.com
Category : runtime: back-end
Severity : serious
Summary: executing a CREATE TABLE statement from a PL/pgSQL script crashes the backend
System Configuration
--------------------
Operating System : RedHat Linux 5.2
PostgreSQL version : 6.4.2
Compiler used : gcc 2.7.2.3
Hardware:
---------
Pentium 166, 32 MB, 1G harddisk
Versions of other tools:
------------------------
gmake 3.76.1
flex 2.5.4
--------------------------------------------------------------------------
Problem Description:
--------------------
I am trying to write a PL/pgSQL function to do a lot of processing on my database. To store intermediate results, I
wantto create a temporary table within the function, and dispose of it at the end. Unfortunately, whatever I try, it
crashesthe backend. The system messages log has this to say about it:
NOTICE: Message from PostgreSQL backend:
^IThe Postmaster has informed me that some other backend died abnormally and possibly corrupted shared memory.
^II have rolled back the current transaction and am going to terminate your database system connection and exit.
^IPlease reconnect to the database system and repeat your query.
--------------------------------------------------------------------------
Test Case:
----------
CREATE FUNCTION table_text () RETURNS text as '
BEGIN
CREATE TABLE "temp2" ("tempid" int4);
RETURN ''finished'';
END;
SELECT table_test();
--------------------------------------------------------------------------
Solution:
---------
--------------------------------------------------------------------------