Re: Mystery with REVOKE PRIVILEGE

From: Konstantin Knizhnik <knizhnik(at)garret(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: Re: Mystery with REVOKE PRIVILEGE
Date: 2026-01-22 13:45:09
Message-ID: c8e166a6-173b-4637-8e94-4b447b49adab@garret.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 21/01/2026 1:07 AM, Tom Lane wrote:
> Nathan Bossart <nathandbossart(at)gmail(dot)com> writes:
>> On Tue, Jan 20, 2026 at 04:32:31PM -0500, Tom Lane wrote:
>>> I don't think "let's make select_best_grantor even more magic"
>>> is the right approach. IMO, if there is a GRANTED BY clause,
>>> we should use exactly that grantor and not apply select_best_grantor
>>> at all. This is, for example, certainly the behavior needed for
>>> pg_dump.
>> I started on something like that here:
>> https://postgr.es/m/aRYLkTpazxKhnS_w%40nathan
> Ah, I wonder if that discussion was lurking in my hindbrain.
> I just posted a different take on how to do it in that thread,
> but the behavioral change should be the same.
>
> regards, tom lane

Thank you.
Fixing explicit grantor case is definitely the most critical thing.
And I completely agree with your patch.
But I wonder if we do refactoring of this revoke privileges stuff,
should we also provide correct (expected) behaviour in case of missing
grantor specification. i.e.

     revoke all privileges on table <T> from <role>;

If privileges to access this table were granted to this role by multiple
grantors, then it is natural to expect that the statement above will
remove all such grants and so as a result <role> can not access this
table any more, rather than try to find best grantor and finally still
leave privileges for this role, isn't it?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-01-22 13:47:28 Re: pgsql: tests: Add a test C++ extension module
Previous Message Tatsuro Yamada 2026-01-22 13:03:52 Re: [PATCH] psql: add \dcs to list all constraints