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 <[email protected]>
Author: Hayato Kuroda <[email protected]>
Reviewed-by: Shlok Kyal <[email protected]>
Reviewed-by: Amit Kapila <[email protected]>
Backpatch-through: 17, where it was introduced
Discussion: 
https://postgr.es/m/os9pr01mb121493da4c1a7748b11a646d8f5...@os9pr01mb12149.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/02decf9a9abc76f04a8117aba524dbe561cb720e

Modified Files
--------------
src/bin/pg_dump/pg_backup_archiver.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Reply via email to