Re: Bug / shortcoming in has_*_privilege

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Jim Nasby <jim(at)nasby(dot)net>
Cc: PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bug / shortcoming in has_*_privilege
Date: 2010-09-06 21:16:57
Message-ID: 1283807431-sup-3414@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Jim Nasby's message of jue jun 10 17:54:43 -0400 2010:
> test_us(at)workbook=# select has_table_privilege( 'public', 'test', 'SELECT' );
> ERROR: role "public" does not exist

Here's a patch implementing this idea.

I'm not too sure about the wording in the doc changes. If somebody
wants to propose something better, I'm all ears. To facilitate
bikeshedding, here's a relevant extract:

has_table_privilege checks whether a user can access a table in
a particular way. The user can be specified by name; as public,
to indicate the PUBLIC pseudo-role; by OID (pg_authid.oid), or,
if the argument is omitted, current_user is assumed.

(the first appearance of public is <literal>public</>. I had first made
it <quote> but that didn't feel right.)

Another thing that could raise eyebrows is that I chose to remove the
"missing_ok" argument from get_role_oid_or_public, so it's not a perfect
mirror of it. None of the current callers need it, but perhaps people
would like these functions to be consistent.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Attachment Content-Type Size
public-has-privileges-3.patch application/octet-stream 15.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-09-06 21:31:12 Re: Bug / shortcoming in has_*_privilege
Previous Message Tom Lane 2010-09-06 21:03:38 Re: Interruptible sleeps (was Re: CommitFest 2009-07: Yay, Kevin! Thanks, reviewers!)