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