Re: About temporary table

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: jack <datactrl(at)tpg(dot)com(dot)au>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: About temporary table
Date: 2002-03-25 21:05:29
Message-ID: 200203252105.g2PL5TD16361@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

jack wrote:
>
> ----- Original Message -----
> From: "David Stanaway" <David(at)Stanaway(dot)net>
> To: "jack" <datactrl(at)tpg(dot)com(dot)au>
> Sent: Monday, March 25, 2002 2:17 PM
> Subject: Re: [SQL] About temporary table
>
>
> >
> > ----- Original Message -----
> > From: jack <datactrl(at)tpg(dot)com(dot)au>
> > To: <pgsql-sql(at)postgresql(dot)org>
> > Sent: Sunday, March 24, 2002 10:11 PM
> > Subject: Re: [SQL] About temporary table
>
> > You can see if its in the relevant system tables, then drop it.
>
> But how can we find the exact name of a temporary table? Or do you know
> which system table has the name mapping?

There is actually no way to know the name from the table name, but if
there is only one temp table, pg_class will have the oid of the backend
in the table name. To get the backend pid, you can use libpq's
PQbackendPID() function or do this:

create function getpid () returns int as '/shlib/libc.so'
language 'c';

test=> select getpid();
getpid
--------
16011
(1 row)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2002-03-25 21:06:39 Re: call the same pl/pgsql procedure twice in the same connection
Previous Message Tom Lane 2002-03-25 21:03:49 Re: About EXECUTE in pl/pgsql