X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 49BF7D1B512 for ; Sat, 27 Sep 2003 17:09:36 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 56934-03 for ; Sat, 27 Sep 2003 14:09:26 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id AC08ED1B4E6 for ; Sat, 27 Sep 2003 14:09:25 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8RH9P6c006295; Sat, 27 Sep 2003 13:09:26 -0400 (EDT) To: "George A.J" Cc: pgsql-sql@postgresql.org Subject: Re: Temporary tables In-reply-to: <20030927133139.42953.qmail@web14911.mail.yahoo.com> References: <20030927133139.42953.qmail@web14911.mail.yahoo.com> Comments: In-reply-to "George A.J" message dated "Sat, 27 Sep 2003 06:31:39 -0700" Date: Sat, 27 Sep 2003 13:09:25 -0400 Message-ID: <6294.1064682565@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/350 X-Sequence-Number: 15328 "George A.J" 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