Re: Are temp table really invisible for existing table - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Are temp table really invisible for existing table
Date
Msg-id 20320.996850058@sss.pgh.pa.us
Whole thread Raw
In response to Are temp table really invisible for existing table  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
>  but, when i try to create a new table (not temp) with the same name
>  as that of name of temporary table recently created it gives me
>  message as "the table already exists"

This is the intended behavior...

> should it be happened ?

Dunno.  As things currently stand, the only thing we could do
differently is to automatically drop the temp table when we see a
regular create for the same name.  (If we don't, the existence of
the temp table creates naming conflicts that will cause problems
for the regular create.)  That doesn't seem like a great idea to me.

> *  Is there any function to check the existance of temporary table,

Not at the moment.  You might consider creating the temp table at the
start of a client session, and letting the function just assume that
it exists.  (Once we implement schemas it should be possible to look
in the system catalogs to check existence of a temp table, but the
way it's done right now is a kluge that's not reflected in the
catalogs.)

            regards, tom lane

pgsql-bugs by date:

Previous
From: pgsql-bugs@postgresql.org
Date:
Subject: Are temp table really invisible for existing table
Next
From: Bruce Momjian
Date:
Subject: Re: Are temp table really invisible for existing table