On 2 Feb 2006, at 23:57, Tom Lane wrote:
> Murat Tasan <murat.tasan@cwru.edu> writes:
>> If user A comes along and has no SELECT privileges on T, but has
>> EXECUTE privileges on F, A is not permitted to run the function, with
>> an error stating access to T is needed.
All within schema "public"...
Let T be a table (say with primary key "id" and column "name") with
no SELECT privileges for user A.
Now, as the owner of the database, execute
CREATE FUNCTION F(T.id%TYPE) RETURNS T.name%TYPE AS $$ SELECT name
FROM T WHERE id = $1; $$ LANGUAGE SQL;
Now login as user A and try:
SELECT * FROM F(69);
(and let 69 be some id in T).
The execution fails, stating that user A doesn't have SELECT
privileges on T.
>> Now, if user B comes along and has SELECT privileges on T, but not
>> EXECUTE privileges on F, B is permitted to run the function.
This latter problem has been addressed by Michael Fuhr's email, I
didn't realize all new functions had PUBLIC execution permissions by
default, so revoking B's permissions to execute F don't make a
difference until I revoke PUBLIC's permissions as well. In fact, I
didn't see this anywhere in the documentation, although that's
probably my fault from my frequent speed-reading ;-)
> I don't think I believe either of the above statements. Perhaps you
> could provide a complete example of what you're doing?
>
> regards, tom lane
Thanks again for all the help!
Murat