pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dennis Sacks <dennis@illusions.com>
To: pgsql-sql@postgresql.org
Subject: simulating global temp tables in plpgsql functions
Date: Mon, 27 Dec 2004 17:20:06 -0700
Message-ID: <41D0A6B6.7060701@illusions.com> (raw)

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



Message-ID: <41D0A6B6.7060701@illusions.com>
Permalink:  ../41D0A6B6.7060701@illusions.com/
Also on:    postgresql.org/message-id/41D0A6B6.7060701@illusions.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dennis@illusions.com
  Subject: Re: simulating global temp tables in plpgsql functions
  In-Reply-To: <41D0A6B6.7060701@illusions.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox