Re: Find dangling membership roles in pg_dumpall

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Andreas 'ads' Scherbaum <ads(at)pgug(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Find dangling membership roles in pg_dumpall
Date: 2023-04-26 11:02:26
Message-ID: ED3207DF-9561-4854-ABC1-057BF6BD247C@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 26 Apr 2023, at 12:18, Andreas 'ads' Scherbaum <ads(at)pgug(dot)de> wrote:
>
>
> Hello,
>
> pg_dumpall.c has a function dumpRoleMembership() which dumps all
> membership roles. This function includes a piece of code which checks
> if the membership tree has an open end which can't be resolved.
> However that code is never used.
>
> The variable prev_remaining is initially set to 0, and then never changed.
> Which in turn never executes this code:
>
> if (remaining == prev_remaining)
>
> because the loop is only entered while "remaining > 0".
>
> The attached patch fixes this problem, and updates prev_remaining inside
> the loop.

Nice catch, that indeed seems like a proper fix. This was introduced in
ce6b672e44 and so doesn't need a backpatch.

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2023-04-26 11:10:10 Re: Add two missing tests in 035_standby_logical_decoding.pl
Previous Message Zhijie Hou (Fujitsu) 2023-04-26 10:41:22 RE: Perform streaming logical transactions by background workers and parallel apply