[Patch] Fix check_pub_rdt bypass when origin is set in same ALTER SUBSCRIPTION

From: SATYANARAYANA NARLAPURAM <satyanarlapuram(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [Patch] Fix check_pub_rdt bypass when origin is set in same ALTER SUBSCRIPTION
Date: 2026-05-26 22:49:55
Message-ID: CAHg+QDfe7WPOhVGKzv83ZB+BmXM88r=KPQn1sa_ZXMMChcNo=A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

HI hackers,

When ALTER SUBSCRIPTION SET (retain_dead_tuples = true, origin = 'none')
is used, the publisher version/recovery check was bypassed because the
origin handling unconditionally overwrote check_pub_rdt to false.

Fix by using |= instead of = so that the flag set by retain_dead_tuples
cannot be cleared by a subsequent origin assignment in the same command.

Attached two patches where 0001 is the code fix and 0002 is a tap fix test
to reproduce
the problem. I didn't fully polish the test, intended only for the
reviewers to reproduce the
problem with a standby setup. Let me know if you would like to include the
test.

Thanks,
Satya

Attachment Content-Type Size
0001-Fix-check_pub_rdt-bypass-when-origin-is-set-in-same-.patch application/octet-stream 1.6 KB
0002-Add-TAP-test-for-check_pub_rdt-bypass-fix.patch application/octet-stream 7.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2026-05-26 22:50:23 Re: Proposal: Conflict log history table for Logical Replication
Previous Message Henson Choi 2026-05-26 22:31:02 Re: Row pattern recognition