Re: Proper object locking for GRANT/REVOKE

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proper object locking for GRANT/REVOKE
Date: 2024-11-09 12:43:13
Message-ID: 45ece515-a722-485c-8fce-608dda529207@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 31.10.24 15:26, Bertrand Drouvot wrote:
> + address = get_object_address(objtype, lfirst(cell), &relation, lockmode, false);
> + Assert(relation == NULL);
>
> Worth to explain why we do expect relation to be NULL here? (the comment on top
> of get_object_address() says it all, but maybe a few words here could be worth
> it).

There are several other callers with this pattern.

Maybe it would be better to push the assertion into
get_object_address(), something like

Assert(!relation || relp)

near the end. Meaning, if you pass NULL for the relp argument, then you
don't expect a relation. This is kind of what will happen now anyway,
except with a segfault instead of an assertion.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kirill Reshke 2024-11-09 12:55:04 Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row
Previous Message Alvaro Herrera 2024-11-09 12:29:12 Re: not null constraints, again