From 9f15188a1b822fafa59ca2b022a876fde0a175b8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 12 Jan 2021 13:37:38 -0500 Subject: [PATCH] pg_dump: label INDEX ATTACH ArchiveEntries with an owner. Although a partitioned index's attachment to its parent doesn't have separate ownership, the ArchiveEntry for it needs to be marked with an owner anyway, to ensure that the ALTER command is run by the appropriate role when restoring with --use-set-session-authorization. Without this, the ALTER will be run by the role that started the restore session, which will usually work but it's formally the wrong thing. Back-patch to v11 where this type of ArchiveEntry was added. In HEAD, add equivalent commentary to the just-added TABLE ATTACH case, which I'd made do the right thing already. Discussion: https://postgr.es/m/1094034.1610418498@sss.pgh.pa.us --- src/bin/pg_dump/pg_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index ad7c0376c9b..607167c5023 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -16532,7 +16532,7 @@ dumpIndexAttach(Archive *fout, IndexAttachInfo *attachinfo) attachinfo->dobj.name, attachinfo->dobj.namespace->dobj.name, NULL, - "", + attachinfo->parentIdx->indextable->rolname, false, "INDEX ATTACH", SECTION_POST_DATA, q->data, "", NULL, NULL, 0, -- 2.39.5