1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Accept 'public' as a pseudo-role name in has_table_privilege() and friends

to see if a particular privilege has been granted to PUBLIC.

The issue was reported by Jim Nasby.
Patch by Alvaro Herrera, and reviewed by KaiGai Kohei.
This commit is contained in:
Itagaki Takahiro
2010-10-13 14:37:23 +09:00
parent f4d242ef94
commit d0f876ca8c
2 changed files with 42 additions and 27 deletions

View File

@ -12348,8 +12348,8 @@ SET search_path TO <replaceable>schema</> <optional>, <replaceable>schema</>, ..
<para>
<function>has_table_privilege</function> checks whether a user
can access a table in a particular way. The user can be
specified by name or by OID
(<literal>pg_authid.oid</literal>), or if the argument is
specified by name, by OID (<literal>pg_authid.oid</literal>),
<literal>public</> to indicate the PUBLIC pseudo-role, or if the argument is
omitted
<function>current_user</function> is assumed. The table can be specified
by name or by OID. (Thus, there are actually six variants of
@ -12496,7 +12496,8 @@ SELECT has_function_privilege('joeuser', 'myfunc(int, text)', 'execute');
<function>pg_has_role</function> checks whether a user
can access a role in a particular way.
Its argument possibilities
are analogous to <function>has_table_privilege</function>.
are analogous to <function>has_table_privilege</function>,
except that <literal>public</> is not allowed as a user name.
The desired access privilege type must evaluate to some combination of
<literal>MEMBER</literal> or
<literal>USAGE</literal>.