has_table_privilege for a table in unprivileged schema causes anerror - Mailing list pgsql-hackers

From Yugo Nagata
Subject has_table_privilege for a table in unprivileged schema causes anerror
Date
Msg-id 20180817075100.bc99378255943d3c3951ad63@sraoss.co.jp
Whole thread Raw
Responses Re: has_table_privilege for a table in unprivileged schema causes an error
List pgsql-hackers
Hi,

I found that has_table_privilege returns an error when a table is specified
by schema-qualified name and the user doen't have privilege for its schema.

 postgres=> select has_table_privilege('myschema.tbl','select');
 ERROR:  permission denied for schema myschema

I think that this function should return false because the user doesn't have
the privilege on this table eventually.  It is more useful for users because
it is not needed to parse the schema-qualified table name and check the
privilege on the schema in advance.

Attached is a patch to modify the function like that. This is WIP patch, so
only has_table_previlege is modified and other familiy functions are left as
they are. Also, there is no additional test yet.

One consern on this patch is that modifying the function can break the 
back-compatibility, so it might be better to add a new parameter to
control the behavior of the function. 

Any comments would be appriciated.

Regards,
-- 
Yugo Nagata <nagata@sraoss.co.jp>

Attachment

pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: docs: note ownership requirement for refreshing materializedviews
Next
From: Michael Paquier
Date:
Subject: Re: Incorrect error handling for two-phase state files resulting indata loss