Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit436d9c5

Browse files
committed
pg_dump: label INDEX ATTACH ArchiveEntries with an owner.
Although a partitioned index's attachment to its parent doesn'thave separate ownership, the ArchiveEntry for it needs to bemarked with an owner anyway, to ensure that the ALTER commandis run by the appropriate role when restoring with--use-set-session-authorization. Without this, the ALTER willbe run by the role that started the restore session, which willusually 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 ATTACHcase, which I'd made do the right thing already.Discussion:https://postgr.es/m/1094034.1610418498@sss.pgh.pa.us
1 parenta2768e4 commit436d9c5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎src/bin/pg_dump/pg_dump.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16638,9 +16638,17 @@ dumpIndexAttach(Archive *fout, IndexAttachInfo *attachinfo)
1663816638
appendPQExpBuffer(q, "ATTACH PARTITION %s;\n",
1663916639
fmtQualifiedDumpable(attachinfo->partitionIdx));
1664016640

16641+
/*
16642+
* There is no point in creating a drop query as the drop is done by
16643+
* index drop. (If you think to change this, see also
16644+
* _printTocEntry().) Although this object doesn't really have
16645+
* ownership as such, set the owner field anyway to ensure that the
16646+
* command is run by the correct role at restore time.
16647+
*/
1664116648
ArchiveEntry(fout, attachinfo->dobj.catId, attachinfo->dobj.dumpId,
1664216649
ARCHIVE_OPTS(.tag = attachinfo->dobj.name,
1664316650
.namespace = attachinfo->dobj.namespace->dobj.name,
16651+
.owner = attachinfo->parentIdx->indextable->rolname,
1664416652
.description = "INDEX ATTACH",
1664516653
.section = SECTION_POST_DATA,
1664616654
.createStmt = q->data));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp