Re: Temporary tables and miscellaneous schemas

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, btober(at)seaworthysys(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: Temporary tables and miscellaneous schemas
Date: 2003-10-27 21:01:34
Message-ID: 7040.1067288494@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sean Chittenden <sean(at)chittenden(dot)org> writes:
> Um, I forget whether or not this was given any credence or anyone
> weighed in on it, but what about having two modes for psql? An admin
> mode which hides nothing and is the default for superuser connections,
> and a user mode which is the default for non-DBA connections.

I thought that would be likely to create more confusion than it solves.

To take just one problem, the newbies who could use the "friendly user"
mode are very likely the same ones who do all their work as postgres,
because it hasn't occurred to them to create any unprivileged users.
They won't get the benefit of it if we make it act as you suggest.

BTW, if I lose this argument, there *is* a workable way to get the
behavior Bruce wants: use current_schemas() to detect which temp schema
is in your search path.

regression=# select nspname from pg_namespace;
nspname
--------------------
pg_temp_2
pg_toast
pg_temp_1
pg_catalog
public
information_schema
(6 rows)

regression=# select nspname from pg_namespace where nspname not like
regression-# 'pg\\_temp\\_%' or nspname = any (current_schemas(true));
nspname
--------------------
pg_toast
pg_catalog
public
information_schema
(4 rows)

regression=# create temp table foo(f1 int);
CREATE TABLE
regression=# select nspname from pg_namespace where nspname not like
regression-# 'pg\\_temp\\_%' or nspname = any (current_schemas(true));
nspname
--------------------
pg_temp_2
pg_toast
pg_catalog
public
information_schema
(5 rows)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-10-27 21:07:21 Re: Temporary tables and miscellaneous schemas
Previous Message Bruce Momjian 2003-10-27 21:00:08 Re: Temporary tables and miscellaneous schemas