Re: [GENERAL] Temporary tables and miscellaneous schemas

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sean Chittenden <sean(at)chittenden(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, btober(at)seaworthysys(dot)com
Subject: Re: [GENERAL] Temporary tables and miscellaneous schemas
Date: 2003-12-22 22:01:42
Message-ID: 200312222201.hBMM1g012233@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Tom Lane wrote:
> >> Why are you doing any of this? We had agreed to suppress all temp
> >> schemas, period. The query should be simple.
>
> > I know some feel that showing any temporary schemas is wrong, but it
> > seems that the local temp schema has valuable information. If I do \d
> > pg_temp_1.*, I see all my temporary tables. I know we have a TODO to
> > show all existing prepared statements, and giving people a way to see
> > their temp tables seems important.
>
> We already have a way to find out your temp table schema name:
> current_schemas.
>
> regression=# create temp table foo(f1 int);
> CREATE TABLE
> regression=# select current_schemas(true);
> current_schemas
> -------------------------------
> {pg_temp_1,pg_catalog,public}
> (1 row)
>
> regression=# select (current_schemas(true))[1];
> current_schemas
> -----------------
> pg_temp_1
> (1 row)
>
> regression=# select relname from pg_class c join pg_namespace n
> regression-# on relnamespace = n.oid
> regression-# where nspname = (current_schemas(true))[1];
> relname
> ---------
> foo
> (1 row)
>
>
> I don't think it's reasonable to complicate \dn so much in order to
> provide an alternative way of learning your temp schema name.

Is current_schemas(true))[1] always the temp schema name? That would
clean things up nicely.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-12-22 22:04:50 Re: [COMMITTERS] pgsql-server/doc/src/sgml Tag: REL7_4_STABLE
Previous Message Tom Lane 2003-12-22 21:59:48 Re: [GENERAL] Temporary tables and miscellaneous schemas

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2003-12-22 22:08:16 Doc patch--clarifying $1 in PL/PgSQL
Previous Message Tom Lane 2003-12-22 21:59:48 Re: [GENERAL] Temporary tables and miscellaneous schemas