Fix pg_dump of grouped large object ACLs granted by a non-owner

Started by Baji Shaik23 days ago1 messageshackers

Thread notes

1 note#bug
hackorum-bot#bug
hackorum-bot
2 days ago

@global #bug

#bug
Jump to latest
#1Baji Shaik
baji.pgdev@gmail.com

Hi,

I noticed that pg_dump fails an assertion in IssueACLPerBlob() when
large objects that pg_dump groups together have grants made by a role
other than the owner. Non-assert builds instead write commands like
"SET SESSION AUTHORIZATION bob16385(null);", so the restore fails.

CREATE ROLE bob;
SELECT lo_create(16385), lo_create(16386);
GRANT SELECT ON LARGE OBJECT 16385, 16386 TO bob WITH GRANT OPTION;
SET ROLE bob;
GRANT SELECT ON LARGE OBJECT 16385, 16386 TO PUBLIC;
RESET ROLE;
-- then pg_dump the database

IssueACLPerBlob() expects every ACL command to name a large object,
but the SET/RESET SESSION AUTHORIZATION commands around the grantor's
GRANTs don't. The attached patch emits those commands once, unchanged,
and adds a test. This came with a45c78e3284, so it affects 17 and later.

Thoughts?

Thanks,
Baji Shaik

Attachments:

0001-Fix-pg_dump-of-grouped-large-object-ACLs-granted-by-.patchapplication/octet-stream; name=0001-Fix-pg_dump-of-grouped-large-object-ACLs-granted-by-.patchDownload+41-4