"Tom Lane" <Tom Lane> writes:
>The SQL spec's notion of temp tables is only tenuously related to ours
>in the first place :-(.  However, the spec appears to require that
>references to temp tables be unqualified names, so AFAICT it's not
>expected that applications can reference more than one schema's worth
>of temp tables anyway.

ISTM that if use of qualified names is disallowed you shouldn't be
allowed to create a temporary table with the same name as an existing
table.  Otherwise you have an unclear (or arbitrary) definition of which
table is used in an unqualified reference.  In this case, I think the
SQL spec was not thought out very well.  In my way of thinking,
temporary tables should behave just like normal tables wrt name
resolution.

Also, it's worth noting that qualified names for temp tables are an
allowed syntax except during the create table statement (although in
normal circumstances you would never know the namespace).  Because of
this, qualified name restriction appears to feel like an arbitrary
exclusion.  

I did not see a TODO item regarding global temporary tables...has this
been attempted/done?

Regards,
Merlin


Tue, 16 Sep 2003 15:23:57 -0400
"Merlin Moncure" <merlin.moncure@rcsonline.com>
Re: observations about temporary tables and schemas 
"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:
> ... In this case, I think the
> SQL spec was not thought out very well.

Many people think that about a lot of aspects of the spec ;-)

> I did not see a TODO item regarding global temporary tables...has this
> been attempted/done?

We concluded in the last discussion of this subject that our existing
temp table behavior actually approaches the spec's GLOBAL TEMP behavior
more nearly than it does LOCAL TEMP; but in any case, without modules
the difference is moot.  Accordingly, 7.4 will accept either syntax,
and there is no more TODO.  See the archives from a few months back, or
http://developer.postgresql.org/docs/postgres/sql-createtable.html#SQL-CREATETABLE-COMPATIBILITY
which distills that discussion.

			regards, tom lane

Tue, 16 Sep 2003 15:32:03 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: observations about temporary tables and schemas 