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

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

Hi,

> In the first place, you are evidently running as superuser, which means
> that has_foo_privilege will ALWAYS say 't'

Ok, seems reasonable ;)

> (except possibly if the
> target object doesn't exist, in which case I think you get an error).

Yep, one does.

> In the second place, trying to access another session's temp table is
> unsupported.

I understand, it's more the opposite, I was fixing a bug in a plpgsql function
that would fail when the user has created a certain (temporary) table in a
second session, because the code only checked the existence of the table_name
without taking into account the proper schema.

> 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...

Got that, looks like an acceptable workaround in this case, though.

Is there a guaranteed order of the resulting array, i.e. is this guaranteed to
return the temp schema, given there is one:

'select (current_schemas(true))[1]'.....?

(obviously, regexp's will also do the trick, I'm just asking)

--
Best,

Frank.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-02-27 21:58:38 Re: has_table/schema_privilige() returns incorrect info on temp tables
Previous Message Tom Lane 2006-02-27 21:19:21 Re: has_table/schema_privilige() returns incorrect info on temp tables