Re: predefined role(s) for VACUUM and ANALYZE

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: predefined role(s) for VACUUM and ANALYZE
Дата
Msg-id 20221206195108.GD3078082@nathanxps13
обсуждение исходный текст
Ответ на Re: predefined role(s) for VACUUM and ANALYZE  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
Список pgsql-hackers
On Tue, Dec 06, 2022 at 11:47:50AM +0000, Dagfinn Ilmari Mannsåker wrote:
> These checks are getting rather repetitive, how about a data-driven
> approach, along the lines of the below patch?  I'm not quite happy with
> the naming of the struct and its members (and maybe it should be in a
> header?), suggestions welcome.

+1.  I wonder if we should also consider checking all the bits at once
before we start checking for the predefined roles.  I'm thinking of
something a bit like this:

    role_mask = ACL_SELECT | ACL_INSERT | ACL_UPDATE |
                ACL_DELETE | ACL_VACUUM | ACL_ANALYZE;

    if (mask & role_mask != result & role_mask)
    {
        ... existing checks here ...
    }

I'm skeptical this actually produces any measurable benefit, but presumably
the predefined roles list will continue to grow, so maybe it's still worth
adding a fast path.

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



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

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: Temporary tables versus wraparound... again
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Temporary tables versus wraparound... again