agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Allow logical replication workers to ignore default_transaction_
2+ messages / 1 participants
[nested] [flat]

* pgsql: Allow logical replication workers to ignore default_transaction_
@ 2026-07-21 04:02  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2026-07-21 04:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow logical replication workers to ignore default_transaction_read_only.

Sequence synchronization updates sequence state via setval(), which
explicitly calls PreventCommandIfReadOnly(). If
default_transaction_read_only is enabled on the subscriber, this causes
sequencesync workers to fail with "cannot execute setval() in a read-only
transaction". Apply and tablesync workers are not affected, since they
write via direct heap access rather than through these read-only-checked
functions.

Rather than special-casing sequencesync, override
default_transaction_read_only to "off" for all logical replication workers
in InitializeLogRepWorker(), the same way session_replication_role and
search_path are already forced there. This keeps the initialization
uniform.

For PG-19, we kept the fix narrow by overriding
default_transaction_read_only to "off" only for sequencesync workers.

Reported-by: Noah Misch <noah@leadboat.com>
Author: vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/20260710045217.f0.noahmisch@microsoft.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d774576f6f05f65e3a944eb509ef0620ea6b107e

Modified Files
--------------
src/backend/replication/logical/worker.c |  8 +++++
src/test/subscription/t/036_sequences.pl | 51 ++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Allow logical replication workers to ignore default_transaction_
@ 2026-07-21 04:02  Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2026-07-21 04:02 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Allow logical replication workers to ignore default_transaction_read_only.

Sequence synchronization updates sequence state via setval(), which
explicitly calls PreventCommandIfReadOnly(). If
default_transaction_read_only is enabled on the subscriber, this causes
sequencesync workers to fail with "cannot execute setval() in a read-only
transaction". Apply and tablesync workers are not affected, since they
write via direct heap access rather than through these read-only-checked
functions.

Rather than special-casing sequencesync, override
default_transaction_read_only to "off" for all logical replication workers
in InitializeLogRepWorker(), the same way session_replication_role and
search_path are already forced there. This keeps the initialization
uniform.

For PG-19, we kept the fix narrow by overriding
default_transaction_read_only to "off" only for sequencesync workers.

Reported-by: Noah Misch <noah@leadboat.com>
Author: vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 19
Discussion: https://postgr.es/m/20260710045217.f0.noahmisch@microsoft.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4cd02d552263ed8d4b148aaefd24cd9dd8af57ed

Modified Files
--------------
src/backend/replication/logical/sequencesync.c |  8 ++++
src/test/subscription/t/036_sequences.pl       | 51 ++++++++++++++++++++++++++
2 files changed, 59 insertions(+)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-07-21 04:02 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-07-21 04:02 pgsql: Allow logical replication workers to ignore default_transaction_ Amit Kapila <akapila@postgresql.org>
2026-07-21 04:02 pgsql: Allow logical replication workers to ignore default_transaction_ Amit Kapila <akapila@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox