diff options
author | Tom Lane | 2024-05-07 22:22:52 +0000 |
---|---|---|
committer | Tom Lane | 2024-05-07 22:23:15 +0000 |
commit | b99dc6694ca64d8e5bd5ee2b0c6bdbbb8cdf4c99 (patch) | |
tree | e4556cc9c022ba2423e5f9b852f4861b94c721f4 | |
parent | abe60b6a0d276a073fc3f057498a920cdab906a9 (diff) |
Ensure that "pg_restore -l" reports dependent TOC entries correctly.
If -l was specified together with selective-restore options such as -n
or -N, dependent TOC entries such as comments would be omitted from
the listing, even when an actual restore would have selected them.
This happened because PrintTOCSummary neglected to update the te->reqs
marking of the entry they depended on.
Per report from Justin Pryzby. This has been wrong since 0d4e6ed30
taught _tocEntryRequired to sometimes look at the "reqs" marking of
other TOC entries, so back-patch to all supported branches.
Discussion: https://postgr.es/m/ZjoeirG7yxODdC4P@pryzbyj2023
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 3d3effc131a..4c4b301a347 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -1219,10 +1219,13 @@ PrintTOCSummary(Archive *AHX) curSection = SECTION_PRE_DATA; for (te = AH->toc->next; te != AH->toc; te = te->next) { + /* This bit must match ProcessArchiveRestoreOptions' marking logic */ if (te->section != SECTION_NONE) curSection = te->section; + te->reqs = _tocEntryRequired(te, curSection, AH); + /* Now, should we print it? */ if (ropt->verbose || - (_tocEntryRequired(te, curSection, AH) & (REQ_SCHEMA | REQ_DATA)) != 0) + (te->reqs & (REQ_SCHEMA | REQ_DATA)) != 0) { char *sanitized_name; char *sanitized_schema; |