Find dangling membership roles in pg_dumpall

From: Andreas 'ads' Scherbaum <ads(at)pgug(dot)de>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Find dangling membership roles in pg_dumpall
Date: 2023-04-26 10:18:16
Message-ID: de44299d-cd31-b41f-2c2a-161fa5e586a5@pgug.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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.

Co-Author: Artur Zakirov <zaartur(at)gmail(dot)com>
who reviewed the patch.

Regards

--
Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project

Attachment Content-Type Size
pg_dumpall.patch text/x-patch 872 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2023-04-26 10:18:39 Re: Doc limitation update proposal: include out-of-line OID usage per TOAST-ed columns
Previous Message Yu Shi (Fujitsu) 2023-04-26 09:58:04 RE: Add two missing tests in 035_standby_logical_decoding.pl