Re: Add pg_get_acl() function get the ACL for a database object

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add pg_get_acl() function get the ACL for a database object
Date: 2024-06-21 03:25:06
Message-ID: ZnTykmQxv2UnECMj@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 20, 2024 at 08:32:57AM +0200, Joel Jacobson wrote:
> I've added overloaded versions for regclass and regproc so far:
>
> \df pg_get_acl
> List of functions
> Schema | Name | Result data type | Argument data types | Type
> ------------+------------+------------------+------------------------+------
> pg_catalog | pg_get_acl | aclitem[] | classid oid, objid oid | func
> pg_catalog | pg_get_acl | aclitem[] | objid regclass | func
> pg_catalog | pg_get_acl | aclitem[] | objid regproc | func
> (3 rows)

Interesting idea.

I am not really convinced that the regproc and regclass overloads are
really necessary, considering the fact that one of the goals
mentioned, as far as I understand, is to be able to get an idea of the
ACLs associated to an object with its dependencies in pg_depend and/or
pg_shdepend. Another one is to reduce the JOIN burden when querying
a set of them, like attribute ACLs.

Perhaps the documentation should add one or two examples to show this
point?

+ tup = get_catalog_object_by_oid(rel, Anum_oid, objectId);
+ if (!HeapTupleIsValid(tup))
+ elog(ERROR, "cache lookup failed for object %u of catalog \"%s\"",
+ objectId, RelationGetRelationName(rel));

get_catalog_object_by_oid() is handled differently here than in
functions line pg_identify_object(). Shouldn't we return NULL for
this case? That would be more useful when using this function with
one or more large scans.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-06-21 03:33:16 Re: Pgoutput not capturing the generated columns
Previous Message Tom Lane 2024-06-21 03:18:35 Re: configure error when CFLAGS='-Wall -Werror