From: Ben <ben@kappia.com>
To: pgsql-sql@postgresql.org
Subject: What is PG best practice for storing temporary data in functions?
Date: Mon, 5 Jul 2004 13:29:52 +0100
Message-ID: <014601c4628b$c651c3c0$0500a8c0@asus> (raw)
There is a very common technique used in other RDBMS (e.g. Sybase)
stored procedure programming which I am not sure how best to replicate
in Postgres functions.
A Sybase stored procedure can do
select <some complex query> into #temp1
create table #temp2 (.)
call some proc which also uses #temp1 and #temp2
etc
where #temp1 and #temp2 are temporary tables magically created by the
server for the duration of the procedure call only (the procedure can be
safely executed in parallel since each execution sees only its own
data). Under the hood, it does this by mangling the names of the temp
tables with a unique identifier for the procedure context.
What are the cleanest and most performant ways to do this in Postgres
(7.4.2)? I am aware of temporary tables but they are globally visible to
other invocations in the same session. We need the equivalent of local
method variables I guess.
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: ben@kappia.com
Subject: Re: What is PG best practice for storing temporary data in functions?
In-Reply-To: <014601c4628b$c651c3c0$0500a8c0@asus>
* 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