pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: George A.J <jinujosein@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Temporary tables
Date: Sat, 27 Sep 2003 13:09:25 -0400
Message-ID: <6294.1064682565@sss.pgh.pa.us> (raw)
In-Reply-To: <20030927133139.42953.qmail@web14911.mail.yahoo.com>
References: <20030927133139.42953.qmail@web14911.mail.yahoo.com>

"George A.J" <jinujosein@yahoo.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



view thread (12+ messages)  latest in thread

Message-ID: <6294.1064682565@sss.pgh.pa.us>
Permalink:  ../6294.1064682565@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6294.1064682565@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jinujosein@yahoo.com
  Subject: Re: Temporary tables
  In-Reply-To: <6294.1064682565@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox