Validate publisher for retain_dead_tuples in the apply worker. Enabling retain_dead_tuples requires the publisher to run PostgreSQL 19 or later and to not be in recovery. Previously this was checked only at DDL time. That forced ALTER SUBSCRIPTION ... ENABLE to connect to the publisher, so pg_upgrade (which re-enables subscriptions during restore) failed if the publisher was unreachable. It was also not authoritative, since the publisher's version or recovery status can change afterwards, for example after a failover.
Perform the check authoritatively in the apply worker when it connects, and stop doing it when enabling a subscription. ENABLE is the only command issued during restore that triggered it, so this also fixes the pg_upgrade failure. The DDL-time check is kept as a convenience for the other paths, none of which are issued during restore. Reported-by: Noah Misch <[email protected]> Analyzed-by: Jeff Davis <[email protected]> Author: Amit Kapila <[email protected]> Reviewed-by: Jeff Davis <[email protected]> Reviewed-by: Hayato Kuroda <[email protected]> Backpatch-through: 19, where it was introduced Discussion: https://postgr.es/m/[email protected] Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/a3fed7608f75336ba748ab2784b2c5fa8cbf284d Modified Files -------------- src/backend/commands/subscriptioncmds.c | 22 +++++++++------------- src/backend/replication/logical/worker.c | 15 +++++++++++++++ src/include/commands/subscriptioncmds.h | 4 ++++ 3 files changed, 28 insertions(+), 13 deletions(-)
