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:03:42
Message-ID: 6b0a52f1-bf81-475f-9be1-b3cce6ba32a4@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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>

/Joel

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joel Jacobson 2024-10-20 21:09:43 Re: Add pg_ownerships and pg_privileges system views
Previous Message Tom Lane 2024-10-20 19:19:00 Re: Using Expanded Objects other than Arrays from plpgsql