Re: has_table/schema_privilige() returns incorrect info on temp tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: has_table/schema_privilige() returns incorrect info on temp tables
Date: 2006-02-27 21:19:21
Message-ID: 22201.1141075161@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl> writes:
> While running 2 sessions in different terminals for the same user, what
> happens in the second session here looks a bit weird:

In the first place, you are evidently running as superuser, which means
that has_foo_privilege will ALWAYS say 't' (except possibly if the
target object doesn't exist, in which case I think you get an error).
In the second place, trying to access another session's temp table is
unsupported.

> In this light, is there a possibility to find out what schema will be used for
> temporary tables created during the current session?

After you've created at least one temp table, you can look at the result
of "current_schemas(true)". There's no guarantee that the schema even
exists before you've created something...

regression=# select current_schemas(true);
current_schemas
---------------------
{pg_catalog,public}
(1 row)

regression=# create temp table t(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=#

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Frank van Vugt 2006-02-27 21:54:53 Re: has_table/schema_privilige() returns incorrect info on temp tables
Previous Message Frank van Vugt 2006-02-27 21:01:17 has_table/schema_privilige() returns incorrect info on temp tables