Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs
Дата
Msg-id 20240327164104.GA4122659@nathanxps13
обсуждение исходный текст
Ответ на Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
On Wed, Mar 27, 2024 at 01:21:23PM -0300, Ranier Vilela wrote:
> Nathan Bossart <nathandbossart(at)gmail(dot)com> writes:
>>Committed with that change. Thanks for the guidance on this one.
> 
> I think that left an oversight in a commit d365ae7
> <https://github.com/postgres/postgres/commit/d365ae705409f5d9c81da4b668f59c3598feb512>
> If the admin_role is a NULL pointer, so, can be dereferenced
> in the main loop of the function roles_is_member_of and
> worst, IMO, can be destroying aleatory memory?
> 
> First, is a better shortcut test to check if admin_role is NOT NULL.
> Second, !OidIsValid(*admin_role), It doesn't seem necessary anymore.
> 
> Or am I losing something?

If admin_role is NULL, then admin_of is expected to be set to InvalidOid.
See the assertion at the top of the function.  AFAICT the code that
dereferences admin_role short-circuits if admin_of is invalid.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: Slow GRANT ROLE on PostgreSQL 16 with thousands of ROLEs