Re: "has_column_privilege()" issue with attnums and non-existent columns

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chengxi Sun <sunchengxi(at)highgo(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Ian Barwick <barwick(at)gmail(dot)com>, David Steele <david(at)pgmasters(dot)net>
Subject: Re: "has_column_privilege()" issue with attnums and non-existent columns
Date: 2021-03-31 17:56:57
Message-ID: 3acb35c6-84bc-54da-c173-69c4b88b06c2@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 3/30/21 8:17 PM, Joe Conway wrote:
> On 3/30/21 6:22 PM, Tom Lane wrote:
>> Joe Conway <mail(at)joeconway(dot)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<-------------------

Pushed that way.

Joe

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-03-31 18:12:52 Re: ModifyTable overheads in generic plans
Previous Message Fabien COELHO 2021-03-31 17:53:24 Re: pgbench - add pseudo-random permutation function