Re: [GENERAL] Means to emulate global temporary table - Mailing list pgsql-general

From John R Pierce
Subject Re: [GENERAL] Means to emulate global temporary table
Date
Msg-id b8525046-98da-3a3a-8b12-e6f838330e3b@hogranch.com
Whole thread Raw
In response to Re: [GENERAL] Means to emulate global temporary table  (Ian Lewis <ilewis@mstarlabs.com>)
Responses Re: [GENERAL] Means to emulate global temporary table  ("David G. Johnston" <david.g.johnston@gmail.com>)
List 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



pgsql-general by date:

Previous
From: Ian Lewis
Date:
Subject: Re: [GENERAL] Means to emulate global temporary table
Next
From: "David G. Johnston"
Date:
Subject: Re: [GENERAL] Means to emulate global temporary table