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

Attachment: 0001-Fix-pg_dump-of-grouped-large-object-ACLs-granted-by-.patch
Description: Binary data

Reply via email to