Re: "has_column_privilege()" issue with attnums and non-existent columns - Mailing list pgsql-hackers

From Joe Conway
Subject Re: "has_column_privilege()" issue with attnums and non-existent columns
Date
Msg-id 9b5f4311-157b-4164-7fe7-077b4fe8ed84@joeconway.com
Whole thread Raw
In response to Re: "has_column_privilege()" issue with attnums and non-existent columns  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: "has_column_privilege()" issue with attnums and non-existent columns  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
On 3/30/21 6:22 PM, Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>> Heh, I missed the forest for the trees it seems.
>> That version undid the changes fixing what Ian was originally complaining about.
> 
> Duh, right.  It would be a good idea for there to be a code comment
> explaining this, because it's *far* from obvious.  Say like
> 
>     * Check for column-level privileges first.  This serves in
>     * part as a check on whether the column even exists, so we
>     * need to do it before checking table-level privilege.

Will do.

> My gripe about providing API-spec comments for the new aclchk.c
> entry points still stands.  Other than that, I think it's good
> to go.

Yeah, I was planning to put something akin to this in all four spots:
8<-------------------
/*
  * Exported routine for checking a user's access privileges to a table
  *
  * Does the bulk of the work for pg_class_aclcheck(), and allows other
  * callers to avoid the missing relation ERROR when is_missing is non-NULL.
  */
AclResult
pg_class_aclcheck_ext(Oid table_oid, Oid roleid,
                      AclMode mode, bool *is_missing)
...
8<-------------------

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: unconstrained memory growth in long running procedure stored procedure after upgrading 11-12
Next
From: "'alvherre@alvh.no-ip.org'"
Date:
Subject: Re: libpq debug log