pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Lex Berezhny <LBerezhny@DevIS.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: TEMP tables
Date: Mon, 03 Feb 2003 10:55:15 +0100
Message-ID: <3E3E3C83.3010607@klaster.net> (raw)
References: <1044235551.2176.29.camel@buddha>

Lex Berezhny wrote:
> hi,
> 
> I have a plpgsql procedure that needs to create a temporary table, use
> it as a stack internally, and then disgard it when the procedure exits.
> 

<cut>

> What are the recommendations or solutions on using temporary tables
> inside functions on a per call basis?
> 
> thanks a lot,

Instead of Bruce solution you can:
1. Create your temporary table only once after you login into database.
Before each execution of your function just delete/truncate this temporary table.
You don't need to drop this table, because it is 
automatically dropped when the session is finished.

2. Use global table as a stack. Use some sessionid to indetify stack for
each procedure execution. Create index on sessionid. There is one more
advantage on this solution - you can use views without recreating them.


Regards,
Tomasz Myrta






view thread (4+ messages)  latest in thread

Message-ID: <3E3E3C83.3010607@klaster.net>
Permalink:  ../3E3E3C83.3010607@klaster.net/
Also on:    postgresql.org/message-id/3E3E3C83.3010607@klaster.net

 · 

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: jasiek@klaster.net, LBerezhny@DevIS.com
  Subject: Re: TEMP tables
  In-Reply-To: <3E3E3C83.3010607@klaster.net>

* 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