Re: Add pg_ownerships and pg_privileges system views

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Alvaro Herrera" <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add pg_ownerships and pg_privileges system views
Date: 2024-10-20 21:09:43
Message-ID: f6b6cd69-d806-4300-84b9-df79b82fd864@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Oct 20, 2024, at 23:03, Joel Jacobson wrote:
> On Sun, Oct 20, 2024, at 16:52, Joel Jacobson wrote:
>> On Sun, Oct 20, 2024, at 12:14, Alvaro Herrera wrote:
>>> I think the function calls should be in the FROM clause, and restrict the
>>> pg_shdepend rows to only the ones in the current database:
>>
>> Cool. I assume pg_ownerships should be changed in the same way?
>> New patch attached.
>>
>>> Now, depending on pg_shdepend for this means that you don't report
>>> anything for an object until a GRANT to another user has been executed.
>>> For example if you REVOKE some priv from the object owner, nothing is
>>> shown until a GRANT is done for another user (and at that point onwards,
>>> privs by the owner are shown). This seems less than ideal, but I'm not
>>> sure how to do different, other than ditching the use of pg_shdepend
>>> entirely.
>>
>> Hmm, yeah that's a bit awkward. Maybe okay if clearly documented.
>
> I've tried to explain this behavior in the docs like this:
>
> <note>
> <para>
> This view reports privileges only when they have been explicitly granted
> to a role other than the object owner. By default, the object owner has all
> privileges on the object, but these default privileges are not displayed
> in this view until a privilege is granted to another role. For example,
> if you revoke some privileges from the object owner, nothing is shown in
> this view until a privilege is granted to another role, after which the
> owner's privileges are also displayed.
> </para>
> </note>

Ops, sorry, forgot to update expected/rules.out, fixed.

/Joel

Attachment Content-Type Size
v5-0001-Add-pg_ownerships-and-pg_privileges-system-views.patch application/octet-stream 17.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-10-20 22:09:23 Re: type cache cleanup improvements
Previous Message Joel Jacobson 2024-10-20 21:03:42 Re: Add pg_ownerships and pg_privileges system views