Re: Add pg_get_acl() function get the ACL for a database object - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Add pg_get_acl() function get the ACL for a database object
Date
Msg-id ZnTykmQxv2UnECMj@paquier.xyz
Whole thread Raw
In response to Re: Add pg_get_acl() function get the ACL for a database object  ("Joel Jacobson" <joel@compiler.org>)
Responses Re: Add pg_get_acl() function get the ACL for a database object
List 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

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: configure error when CFLAGS='-Wall -Werror
Next
From: Peter Smith
Date:
Subject: Re: Pgoutput not capturing the generated columns