From: Tom Lane <tgl@sss.pgh.pa.us>
To: darcy@druid.net
Cc: datactrl <quals@bigfoot.com>
Cc: pgsql-sql@postgresql.org
Cc: roelof.sondaar@scania.com
Subject: Re: how do I check if a temporary table exists?
Date: Sat, 24 Mar 2001 11:39:43 -0500
Message-ID: <23017.985451983@sss.pgh.pa.us> (raw)
In-Reply-To: <20010324124215.A94771A61@druid.net>
References: <20010324124215.A94771A61@druid.net>
darcy@druid.net (D'Arcy J.M. Cain) writes:
> Thus spake datactrl
>> How do I check if a temporary table exists? Searching pg_tables with a
>> temporary table name we chose always fails.
> What do you mean? You know that it exists because you just created it
> and the create succeeded. Can you describe a situation where you need
> to know about a temp table and don't already know?
I can see that it might take some unpleasant restructuring of his client
application to make that knowledge available where & when it's needed.
> It can't go into the pg_tables table because then it would be visible
> to other processes. Are you perhaps misunderstanding temp tables? You
> cannot see them except from the process that created them.
I agree with datactrl that this is a deficiency: the whole point of
system catalogs is that you are supposed to be able to look in them
to see what you have. It should be possible to look up temp tables
in pg_class. They actually are in there (and quite visible to other
processes BTW); what you don't know is the mapping from your logical
name for the table to its real name pg_tempXXXX.
I'm hoping that this can be fixed when we implement schemas. Seems
like it would be natural to make temp tables live in a per-backend
schema. Then they wouldn't need names like pg_tempXXXX. You would
probably need to know the name of your current temp schema, but that
seems like a more tractable thing to deal with than mappings of
individual temp table names.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, darcy@druid.net, quals@bigfoot.com, roelof.sondaar@scania.com
Subject: Re: how do I check if a temporary table exists?
In-Reply-To: <23017.985451983@sss.pgh.pa.us>
References: <20010324124215.A94771A61@druid.net> <23017.985451983@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