| From: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
|---|---|
| To: | buyu zi <zibuyu423(at)gmail(dot)com> |
| Cc: | Kirill Reshke <reshkekirill(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org |
| Subject: | Re: BUG #19962: pg_dumpall can't produce restorable circular grants with ADMIN OPTION |
| Date: | 2026-12-05 22:00:00 |
| Message-ID: | 1148b0e8-1e71-429c-8a08-77e4f6df59fb@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hello zibuyu,
03.12.2026 16:47, buyu zi wrote:
> Hi Alexander,
>
> I reproduced the restore failure with your three-role example. Once
> the original grant to r2 has been revoked, there is no order in which
> pg_dumpall can replay the three remaining grants on their own.
Thank you for working on this!
I've discovered another configuration that pg_dumpall can't process:
CREATE ROLE g; CREATE ROLE m1; CREATE ROLE m2;
GRANT g TO m1 WITH ADMIN OPTION;
GRANT g TO m2 WITH ADMIN OPTION GRANTED BY m1;
GRANT g TO m2 WITH ADMIN OPTION;
GRANT g TO m1 WITH ADMIN OPTION GRANTED BY m2;
REVOKE g FROM m1 GRANTED BY CURRENT_USER;
REVOKE g FROM m2 GRANTED BY CURRENT_USER;
pg_dumpall -f dump.sql
pg_dumpall: error: could not find a legal dump ordering for memberships in role "g"
Your patch handles it correctly.
> I tested both a roles-only dump and a pg_upgrade from 19.0 to 20devel.
> In both cases the restored pg_auth_members rows matched the source,
> including the grantor and the ADMIN, INHERIT and SET options. I also
> checked that interrupting the script partway through the procedure
> definition left no temporary ADMIN grant behind.
I guess the script can break when the database contains multiple circles and
you interrupt it between CALL and DROP PROCEDURE (e.g. in the first block).
Regarding tests, perhaps just creating such loops in privileges.sql (and
leaving them in the regression database) for pg_upgrade test would look
simpler.
> Does using a temporary procedure for this part of the dump seem
> reasonable?
I'm not sure about that -- it looks like this approach was never used
before, maybe BEGIN/COMMIT would be more aligned with the current code.
Best regards,
Alexander
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-12-05 22:11:16 | Re: BUG #19962: pg_dumpall can't produce restorable circular grants with ADMIN OPTION |
| Previous Message | shihao zhong | 2026-12-05 21:57:55 | Re: BUG #19960: Phrase search matches when it should not: phrase positions wrap at 16383 |