Re: Temp table visibility - Mailing list pgsql-general

From Tom Lane
Subject Re: Temp table visibility
Date
Msg-id 2266.1312556108@sss.pgh.pa.us
Whole thread Raw
In response to Re: Temp table visibility  (Andrew Sullivan <ajs@crankycanuck.ca>)
Responses Re: Temp table visibility  (Andrew Sullivan <ajs@crankycanuck.ca>)
List pgsql-general
Andrew Sullivan <ajs@crankycanuck.ca> writes:
> On Fri, Aug 05, 2011 at 08:35:37AM -0400, JJ wrote:
>> I was recently looking at the way "create temp table as" works and the manual specifies that temp tables given the
samename as an existing table will be used instead of the permanent table.  It also states that the permanent table can
beaccessed via its schema-qualified name.  I may have answered my own question but is there any way to emulate this
tablevisibility functionality when referencing tables by their schema-qualified name?  

> No, because the schema qualification is what makes for the visibility
> functionality.

Also, you can change the priority if you have a mind to, by adding
"pg_temp" to the search_path explicitly, for example

    SET search_path = public, pg_temp;

If there's no explicit reference to pg_temp in search_path then it's
implicitly searched first, which is why unqualified references to temp
table names work the way the manual says.

            regards, tom lane

pgsql-general by date:

Previous
From: "Igor Neyman"
Date:
Subject: Re: Postgresql problem with update double precision
Next
From: Tom Lane
Date:
Subject: Re: Select count with offset returns nothing.