Re: has_table/schema_privilige() returns incorrect info on temp tables - Mailing list pgsql-bugs

From Frank van Vugt
Subject Re: has_table/schema_privilige() returns incorrect info on temp tables
Date
Msg-id 200602272254.53742.ftm.van.vugt@foxi.nl
Whole thread Raw
In response to has_table/schema_privilige() returns incorrect info on temp tables  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Responses Re: has_table/schema_privilige() returns incorrect info on temp tables
List 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.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: has_table/schema_privilige() returns incorrect info on temp tables
Next
From: Tom Lane
Date:
Subject: Re: has_table/schema_privilige() returns incorrect info on temp tables