| From: | Tomasz Myrta <jasiek(at)klaster(dot)net> |
|---|---|
| To: | Lex Berezhny <LBerezhny(at)DevIS(dot)com> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: TEMP tables |
| Date: | 2003-02-03 09:55:15 |
| Message-ID: | 3E3E3C83.3010607@klaster.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tomasz Myrta | 2003-02-03 10:01:12 | Re: Commenting PLPGSQL |
| Previous Message | Tambet Matiisen | 2003-02-03 08:37:08 | Re: update and IN vs. EXISTS |