Skip site navigation (1) Skip section navigation (2)

Re: Temp table exists test??

From: Michael Guerin <guerin(at)rentec(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Temp table exists test??
Date: 2005-02-04 02:39:08
Message-ID: 4202E04C.8030705@rentec.com (view raw or flat)
Thread:
Lists: pgsql-novice
I'm trying to detect the existence of a temp table in a function for 
that connection.

So,

Connection 1:
Create table foo (i int);

Connection 2:
select * from pg_class where relname = 'foo'

returns the table from connection 1, however I need to know if there's a 
temp table foo for connection 2 not connection 1.  Each row in pg_class 
is associated with a namespace, so I'm looking for something like:

select * from pg_class where relname = 'foo' and relnamespace = ???

-Michael



Michael Fuhr wrote:

>On Thu, Feb 03, 2005 at 08:16:30PM -0500, Michael Guerin wrote:
>  
>
>>   Is there a way to find out the namespace id (relnamespace) for your 
>>connection?
>>    
>>
>
>It's not clear what you're trying to do.  Are you looking for
>current_schema()?  Or maybe one of the other system information
>functions?
>
>http://www.postgresql.org/docs/8.0/static/functions-info.html
>
>  
>


In response to

Responses

pgsql-novice by date

Next:From: Mike G.Date: 2005-02-04 02:52:28
Subject: Re: how to generate printed output of queries
Previous:From: Ramon OrticioDate: 2005-02-04 02:32:27
Subject: how to generate printed output of queries

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group