Re: How to get schema name in which TEMPORARY table is created?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gnanam(at)zoniac(dot)com
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to get schema name in which TEMPORARY table is created?
Date: 2011-03-08 15:39:56
Message-ID: 9914.1299598796@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

"Gnanakumar" <gnanam(at)zoniac(dot)com> writes:
> We're using PostgreSQL v8.2.3.

> How do I get the schema name in which TEMPORARY table is created using
> "CREATE TEMP TABLE mytable ...." syntax?

Do you need the real schema name, or will the "pg_temp" alias be
sufficient?

regression=# create temp table foo(f1 int);
CREATE TABLE
regression=# select * from pg_temp.foo;
f1
----
(0 rows)

Note: I think that this might not work in 8.2.3 --- I seem to recall
that it was added as part of the CVE-2007-2138 fix, which appeared in
the 8.2.x series in 8.2.4. However, there are many good reasons for
you to update to something later than 8.2.3 anyway.

regards, tom lane

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Heikki Linnakangas 2011-03-08 19:00:14 Re: Re: PD_ALL_VISIBLE flag was incorrectly set happend during repeatable vacuum
Previous Message Lukasz Brodziak 2011-03-08 15:27:09 Re: Unable to create function via psql