public inbox for [email protected]  
help / color / mirror / Atom feed
how to select temp table
15+ messages / 6 participants
[nested] [flat]

* how to select temp table
@ 2009-05-06 12:34  liuzg4 liuzg4 <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: liuzg4 liuzg4 @ 2009-05-06 12:34 UTC (permalink / raw)
  To: [email protected]

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 ???
drop table testtable

then is this table a public or a temp? i test ,it drop temp table fisrst!

so am i  must show  public or pg_temp_1  when i has two table with same name
!!!


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: how to select temp table
@ 2009-05-06 17:59  Robert Gravsjö <[email protected]>
  parent: liuzg4 liuzg4 <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Robert Gravsjö @ 2009-05-06 17:59 UTC (permalink / raw)
  To: liuzg4 liuzg4 <[email protected]>; +Cc: [email protected]

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."

See http://www.postgresql.org/docs/8.4/static/sql-createtable.html for 
details.

/r

> drop table testtable
>
> then is this table a public or a temp? i test ,it drop temp table fisrst!
>
> so am i  must show  public or pg_temp_1  when i has two table with same name
> !!!
>




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: how to select temp table
@ 2009-05-06 19:23  Alvaro Herrera <[email protected]>
  parent: Robert Gravsjö <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-06 19:23 UTC (permalink / raw)
  To: Robert Gravsjö <[email protected]>; +Cc: liuzg4 liuzg4 <[email protected]>; [email protected]

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.



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 19:27  Alvaro Herrera <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 2 replies; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-06 19:27 UTC (permalink / raw)
  To: Robert Gravsjö <[email protected]>; +Cc: liuzg4 liuzg4 <[email protected]>; pgsql-docs

Alvaro Herrera escribió:

> Note that you can refer to the temp table like this:
> 
> select * from pg_temp.testtable;

BTW I found no mention of pg_temp in the doc page here:
http://www.postgresql.org/docs/current/static/ddl-schemas.html

Apparently the only mention of pg_temp is in the CREATE FUNCTION page.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 19:45  David Fetter <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  1 sibling, 1 reply; 15+ messages in thread

From: David Fetter @ 2009-05-06 19:45 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

On Wed, May 06, 2009 at 03:27:28PM -0400, Alvaro Herrera wrote:
> Alvaro Herrera escribió:
> 
> > Note that you can refer to the temp table like this:
> > 
> > select * from pg_temp.testtable;
> 
> BTW I found no mention of pg_temp in the doc page here:
> http://www.postgresql.org/docs/current/static/ddl-schemas.html
> 
> Apparently the only mention of pg_temp is in the CREATE FUNCTION page.

That's probably not a good omission.  Any ideas as to where further
mentions should go?

Cheers,
David.
-- 
David Fetter <[email protected]> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: [email protected]

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 20:46  Tom Lane <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  1 sibling, 1 reply; 15+ messages in thread

From: Tom Lane @ 2009-05-06 20:46 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Alvaro Herrera <[email protected]> writes:
> Apparently the only mention of pg_temp is in the CREATE FUNCTION page.

It's also described under the search_path GUC.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 20:53  Alvaro Herrera <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-06 20:53 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Tom Lane escribió:
> Alvaro Herrera <[email protected]> writes:
> > Apparently the only mention of pg_temp is in the CREATE FUNCTION page.
> 
> It's also described under the search_path GUC.

Hmm, we have another problem then, which is that GUC vars are not
showing in the search results when you search for their names.  For
example if I search for search_path I am suggested 
http://www.postgresql.org/docs/current/static/ddl-schemas.html#DDL-SCHEMAS-PATH
but nothing else.

Oh, I see the problem .. the index entry is "search_path configuration
parameter".  I think it would be better if it were

<primary>search_path</><secondary>configuration parameter</>

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 20:58  Alvaro Herrera <[email protected]>
  parent: David Fetter <[email protected]>
  0 siblings, 0 replies; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-06 20:58 UTC (permalink / raw)
  To: David Fetter <[email protected]>; +Cc: Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

David Fetter escribió:
> On Wed, May 06, 2009 at 03:27:28PM -0400, Alvaro Herrera wrote:
> > Alvaro Herrera escribió:
> > 
> > > Note that you can refer to the temp table like this:
> > > 
> > > select * from pg_temp.testtable;
> > 
> > BTW I found no mention of pg_temp in the doc page here:
> > http://www.postgresql.org/docs/current/static/ddl-schemas.html
> > 
> > Apparently the only mention of pg_temp is in the CREATE FUNCTION page.
> 
> That's probably not a good omission.  Any ideas as to where further
> mentions should go?

I think mentioning it in the page I link to above would be good.  I
can't think of any further places on which it should be mentioned.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 21:11  Tom Lane <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Tom Lane @ 2009-05-06 21:11 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Alvaro Herrera <[email protected]> writes:
> Hmm, we have another problem then, which is that GUC vars are not
> showing in the search results when you search for their names.  For
> example if I search for search_path I am suggested 
> http://www.postgresql.org/docs/current/static/ddl-schemas.html#DDL-SCHEMAS-PATH
> but nothing else.

> Oh, I see the problem .. the index entry is "search_path configuration
> parameter".  I think it would be better if it were

> <primary>search_path</><secondary>configuration parameter</>

Seems like what you are describing is a bug in the search engine,
not a problem we must address by doubling the vertical space needed for
literally hundreds of index entries.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-06 21:19  Alvaro Herrera <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-06 21:19 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs; Magnus Hagander <[email protected]>

Tom Lane escribió:
> Alvaro Herrera <[email protected]> writes:
> > Hmm, we have another problem then, which is that GUC vars are not
> > showing in the search results when you search for their names.  For
> > example if I search for search_path I am suggested 
> > http://www.postgresql.org/docs/current/static/ddl-schemas.html#DDL-SCHEMAS-PATH
> > but nothing else.
> 
> > Oh, I see the problem .. the index entry is "search_path configuration
> > parameter".  I think it would be better if it were
> 
> > <primary>search_path</><secondary>configuration parameter</>
> 
> Seems like what you are describing is a bug in the search engine,
> not a problem we must address by doubling the vertical space needed for
> literally hundreds of index entries.

Yeah, perhaps ...  I think it should suggest all index entries that
start with the search string, not necessarily equal.

Magnus? :-)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-07 13:44  Magnus Hagander <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Magnus Hagander @ 2009-05-07 13:44 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Alvaro Herrera wrote:
> Tom Lane escribió:
>> Alvaro Herrera <[email protected]> writes:
>>> Hmm, we have another problem then, which is that GUC vars are not
>>> showing in the search results when you search for their names.  For
>>> example if I search for search_path I am suggested 
>>> http://www.postgresql.org/docs/current/static/ddl-schemas.html#DDL-SCHEMAS-PATH
>>> but nothing else.
>>> Oh, I see the problem .. the index entry is "search_path configuration
>>> parameter".  I think it would be better if it were
>>> <primary>search_path</><secondary>configuration parameter</>
>> Seems like what you are describing is a bug in the search engine,
>> not a problem we must address by doubling the vertical space needed for
>> literally hundreds of index entries.
> 
> Yeah, perhaps ...  I think it should suggest all index entries that
> start with the search string, not necessarily equal.
> 
> Magnus? :-)

Uh, I don't think that information is even available at that point. We
index only the output of the web pages, not the SGML source.

//Magnus




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-07 15:17  Alvaro Herrera <[email protected]>
  parent: Magnus Hagander <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-07 15:17 UTC (permalink / raw)
  To: Magnus Hagander <[email protected]>; +Cc: Tom Lane <[email protected]>; Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Magnus Hagander escribió:
> Alvaro Herrera wrote:

> > Yeah, perhaps ...  I think it should suggest all index entries that
> > start with the search string, not necessarily equal.
> > 
> > Magnus? :-)
> 
> Uh, I don't think that information is even available at that point. We
> index only the output of the web pages, not the SGML source.

AFAIK the search "suggests" stuff from pg_docbot or something similar.
That includes index entries.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-07 15:23  Magnus Hagander <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Magnus Hagander @ 2009-05-07 15:23 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

On 7 maj 2009, at 17.17, Alvaro Herrera <[email protected]>  
wrote:

> Magnus Hagander escribió:
>> Alvaro Herrera wrote:
>
>>> Yeah, perhaps ...  I think it should suggest all index entries that
>>> start with the search string, not necessarily equal.
>>>
>>> Magnus? :-)
>>
>> Uh, I don't think that information is even available at that point.  
>> We
>> index only the output of the web pages, not the SGML source.
>
> AFAIK the search "suggests" stuff from pg_docbot or something similar.
> That includes index entries.
>

The docbot index is completely manually maintained. It never reads  
anything in our documetation.

/Magnus




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-07 15:28  Alvaro Herrera <[email protected]>
  parent: Magnus Hagander <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Alvaro Herrera @ 2009-05-07 15:28 UTC (permalink / raw)
  To: Magnus Hagander <[email protected]>; +Cc: Tom Lane <[email protected]>; Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Magnus Hagander escribió:
> On 7 maj 2009, at 17.17, Alvaro Herrera <[email protected]>  
> wrote:
>
>> Magnus Hagander escribió:
>>> Alvaro Herrera wrote:
>>
>>>> Yeah, perhaps ...  I think it should suggest all index entries that
>>>> start with the search string, not necessarily equal.
>>>
>>> Uh, I don't think that information is even available at that point.  
>>> We
>>> index only the output of the web pages, not the SGML source.
>>
>> AFAIK the search "suggests" stuff from pg_docbot or something similar.
>> That includes index entries.
>
> The docbot index is completely manually maintained. It never reads  
> anything in our documetation.

So where does the "we suggest this link" data come from?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [GENERAL] how to select temp table
@ 2009-05-08 11:34  Magnus Hagander <[email protected]>
  parent: Alvaro Herrera <[email protected]>
  0 siblings, 0 replies; 15+ messages in thread

From: Magnus Hagander @ 2009-05-08 11:34 UTC (permalink / raw)
  To: Alvaro Herrera <[email protected]>; +Cc: Tom Lane <[email protected]>; Robert Gravsjö <[email protected]>; liuzg4 liuzg4 <[email protected]>; pgsql-docs

Alvaro Herrera wrote:
> Magnus Hagander escribió:
>> On 7 maj 2009, at 17.17, Alvaro Herrera <[email protected]>  
>> wrote:
>>
>>> Magnus Hagander escribió:
>>>> Alvaro Herrera wrote:
>>>>> Yeah, perhaps ...  I think it should suggest all index entries that
>>>>> start with the search string, not necessarily equal.
>>>> Uh, I don't think that information is even available at that point.  
>>>> We
>>>> index only the output of the web pages, not the SGML source.
>>> AFAIK the search "suggests" stuff from pg_docbot or something similar.
>>> That includes index entries.
>> The docbot index is completely manually maintained. It never reads  
>> anything in our documetation.
> 
> So where does the "we suggest this link" data come from?

A manually maintained database. That is regularly (as in, has been once)
synced over from the IRC bot database. Which is, again, manually
maintained by ppl in the irc channel.

//Magnus






^ permalink  raw  reply  [nested|flat] 15+ messages in thread


end of thread, other threads:[~2009-05-08 11:34 UTC | newest]

Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-05-06 12:34 how to select temp table liuzg4 liuzg4 <[email protected]>
2009-05-06 17:59 ` Robert Gravsjö <[email protected]>
2009-05-06 19:23   ` Alvaro Herrera <[email protected]>
2009-05-06 19:27     ` Alvaro Herrera <[email protected]>
2009-05-06 19:45       ` David Fetter <[email protected]>
2009-05-06 20:58         ` Alvaro Herrera <[email protected]>
2009-05-06 20:46       ` Tom Lane <[email protected]>
2009-05-06 20:53         ` Alvaro Herrera <[email protected]>
2009-05-06 21:11           ` Tom Lane <[email protected]>
2009-05-06 21:19             ` Alvaro Herrera <[email protected]>
2009-05-07 13:44               ` Magnus Hagander <[email protected]>
2009-05-07 15:17                 ` Alvaro Herrera <[email protected]>
2009-05-07 15:23                   ` Magnus Hagander <[email protected]>
2009-05-07 15:28                     ` Alvaro Herrera <[email protected]>
2009-05-08 11:34                       ` Magnus Hagander <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox