postgres.git / summary / log / commit / refs

commit    33cffe591deebb873bc7b97a5f5d10eda9d219ae
Author:   Amit Kapila <akapila@postgresql.org>
Date:     Thu Jul 30 06:19:33 2026 +0000

    Skip SUBSCRIPTION TABLE TOC entries with --no-subscriptions.
    
    pg_dump in --binary-upgrade mode emits "SUBSCRIPTION TABLE" TOC entries to
    preserve pg_subscription_rel state across pg_upgrade.  When such a dump
    was restored with --no-subscriptions, _tocEntryRequired() skipped the
    "SUBSCRIPTION" entry but not the associated "SUBSCRIPTION TABLE" entries,
    so the restore would try to apply subscription-relation state for a
    subscription that was never created.
    
    Skip "SUBSCRIPTION TABLE" entries as well when no_subscriptions is set.
    
    This can happen when pg_subscription_rel has entries, the dump is taken
    with --binary-upgrade, and it is restored with --no-subscriptions.
    
    Reported-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
    Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
    Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
    Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
    Backpatch-through: 17, where it was introduced
    Discussion: https://postgr.es/m/OS9PR01MB121493DA4C1A7748B11A646D8F5C02@OS9PR01MB12149.jpnprd01.prod.outlook.com


src/bin/pg_dump/pg_backup_archiver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 46f4c518347..63313e5297e 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -3095,7 +3095,9 @@ _tocEntryRequired(TocEntry *te, teSection curSection, ArchiveHandle *AH) } /* If it's a subscription, maybe ignore it */ - if (ropt->no_subscriptions && strcmp(te->desc, "SUBSCRIPTION") == 0) + if (ropt->no_subscriptions && + (strcmp(te->desc, "SUBSCRIPTION") == 0 || + strcmp(te->desc, "SUBSCRIPTION TABLE") == 0)) return 0; /* Ignore it if section is not to be dumped/restored */ [parent: 55c81430af1c]