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 00:17:46
Message-ID: 9b5f4311-157b-4164-7fe7-077b4fe8ed84@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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<-------------------

Joe

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message 'alvherre@alvh.no-ip.org' 2021-03-31 00:24:00 Re: libpq debug log
Previous Message Tom Lane 2021-03-31 00:14:22 Re: unconstrained memory growth in long running procedure stored procedure after upgrading 11-12