Re: Means to emulate global temporary table

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Means to emulate global temporary table
Date: 2017-01-12 02:51:08
Message-ID: b8525046-98da-3a3a-8b12-e6f838330e3b@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/11/2017 6:39 PM, Ian Lewis wrote:
> Does this mean that a local temporary table created in one function in
> a database is visible globally throughout the database for the
> duration of the session?

postgres temporary tables are only visible to the session that creates
them. all kind of wierdness would happen if they were somehow
visible outside that session, for instance what if another session is
accessing one of these hypothetical things, when the session that
creates the temp table exits ? and, how do you resolve name
conflicts? if session 1 creates temp table ABC, and session 2
creates temp table ABC, how would session 3 know which one to use?
conversely, if each session creates unique names, they'd have to build
every sql statement from string fragments, this is considered poor
practice, and how would session 3 know what unique name to use for one
of these other sessions shared temporary tables? all very confusing.

so I'm still not clear here what it is you expect these 'global temp
tables' to do, and how they are supposed to behave?

--
john r pierce, recycling bits in santa cruz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2017-01-12 03:02:01 Re: Means to emulate global temporary table
Previous Message Ian Lewis 2017-01-12 02:47:51 Re: Means to emulate global temporary table