From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Robert Gravsjö <robert(at)blogg(dot)se> |
Cc: | liuzg4 liuzg4 <liuzg4(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: how to select temp table |
Date: | 2009-05-06 19:23:54 |
Message-ID: | 20090506192354.GK4476@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-general |
Robert Gravsjö escribió:
> On 2009-05-06 14.34, liuzg4 liuzg4 wrote:
>> ver 8.4
>> i create two table with same name named 'testtable'
>>
>> one is temp table
>>
>> i select * from testtable
>> then this table is a public or a temp ???
>
> Temp. To access public use "select * from public.testtable".
>
> "Temporary tables exist in a special schema, so a schema name cannot be
> given when creating a temporary table."
Note that you can refer to the temp table like this:
select * from pg_temp.testtable;
Also, you can make the non-temp table first in the search path by
putting pg_temp later than the public schema (or wherever you have
created the function):
select * from testtable; -- refers to temp
set search_path to 'public', 'pg_temp';
select * from testtable; -- refers to non-temp
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-05-06 19:27:28 | Re: [GENERAL] how to select temp table |
Previous Message | Robert Gravsjö | 2009-05-06 17:59:04 | Re: how to select temp table |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-05-06 19:27:28 | Re: [GENERAL] how to select temp table |
Previous Message | Robert Gravsjö | 2009-05-06 17:59:04 | Re: how to select temp table |