Re: pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries
Дата
Msg-id YM0puvBnbBIZxJt2@paquier.xyz
обсуждение исходный текст
Ответ на pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries
Список pgsql-committers
On Fri, Jun 18, 2021 at 10:00:33PM +0000, Tom Lane wrote:
> Fix misbehavior of DROP OWNED BY with duplicate polroles entries.
>
> Ordinarily, a pg_policy.polroles array wouldn't list the same role
> more than once; but CREATE POLICY does not prevent that.  If we
> perform DROP OWNED BY on a role that is listed more than once,
> RemoveRoleFromObjectPolicy either suffered an assertion failure
> or encountered a tuple-updated-by-self error.  Rewrite it to cope
> correctly with duplicate entries, and add a CommandCounterIncrement
> call to prevent the other problem.
>
> Per discussion, there's other cleanup that ought to happen here,
> but this seems like the minimum essential fix.

A nit here.
+       /* If any roles remain, update the policy entry. */
+       if (num_roles > 0)
+       {
        /* This is the array for the new tuple */
This indentation is incorrect.
--
Michael

Вложения

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Add test case for obsoleting slot with active walsender
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Fix misbehavior of DROP OWNED BY with duplicate polroles entries