Bruce Momjian <pgman@candle.pha.pa.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.
regards, tom lane