simulating global temp tables in plpgsql functions - Mailing list pgsql-sql

From Dennis Sacks
Subject simulating global temp tables in plpgsql functions
Date
Msg-id 41D0A6B6.7060701@illusions.com
Whole thread Raw
List pgsql-sql
Hi,

Once again I'm translating an oracle stored proc that uses a global 
temporary table. Using postgresql's nonglobal temp tables from plpgsql 
functions is painful - translating all the queries into strings passed 
to execute. It is error prone, and it makes the queries less readable, 
thus less maintainable. Plus, the temp tables have to be created per 
postgresql connection, and not recreated if they already exist (making 
connection pooling code more complicated).

So, the other option is to create a normal table and insert & query with 
a unique key, to avoid collisions with other copies of the stored 
function that might be executing at the same time. Is anyone else doing 
this? Does anyone have suggestions for how this might be accomplished 
safely?

Finally, is there any thought to adding global temp tables to 
postgresql? They would make life SO much easier for those of us porting 
from Oracle.

Dennis
dennis@illusions.com


pgsql-sql by date:

Previous
From: Marek Lewczuk
Date:
Subject: Re: [GENERAL] Get current trasanction id
Next
From: Robert Treat
Date:
Subject: Re: diff databases