Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1E64F1337B4E for ; Tue, 8 Mar 2011 11:40:04 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 72296-06 for ; Tue, 8 Mar 2011 15:39:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 3CA741337B3E for ; Tue, 8 Mar 2011 11:39:56 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p28Fduwe009915; Tue, 8 Mar 2011 10:39:56 -0500 (EST) To: gnanam@zoniac.com cc: pgsql-admin@postgresql.org Subject: Re: How to get schema name in which TEMPORARY table is created? In-reply-to: <005201cbdd99$8930e990$9b92bcb0$@com> References: <005201cbdd99$8930e990$9b92bcb0$@com> Comments: In-reply-to "Gnanakumar" message dated "Tue, 08 Mar 2011 19:32:57 +0530" Date: Tue, 08 Mar 2011 10:39:56 -0500 Message-ID: <9914.1299598796@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/90 X-Sequence-Number: 36962 "Gnanakumar" 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