From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "George A(dot)J" <jinujosein(at)yahoo(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Temporary tables |
Date: | 2003-09-27 17:09:25 |
Message-ID: | 6294.1064682565@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
"George A.J" <jinujosein(at)yahoo(dot)com> writes:
> When i searched the pg_class i found the temp table name more than once.
> ie, a temporary table is created for each connection.I cannot distingush
> the temp tables. But the tables are in different schema.
> Is there a method to get the current temporary schema?
Not directly, but you could try something like
perform * from pg_class where
relname = 'mytable' and pg_table_is_visible(oid);
if not found then ... -- create the table
The visibility test would not succeed for temp tables belonging to other
backends. (If 'mytable' is also used as the name of a regular table
then this isn't quite good enough, but I think just avoiding such a name
collision is easier than extending the check to reject non-temp tables.)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bertrand Petit | 2003-09-28 00:17:38 | pg_class.relpages |
Previous Message | Richard Huxton | 2003-09-27 16:21:35 | Re: Temporary tables |