| From: | Amit Kapila <akapila(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Allow logical replication workers to ignore default_transaction_ |
| Date: | 2026-07-21 04:02:06 |
| Message-ID: | E1wm1gE-0000000072p-1LHy@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)leadboat(dot)com>
Author: vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)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(+)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2026-07-21 06:50:05 | pgsql: Test what BEFORE UPDATE triggers do to FOR PORTION OF |
| Previous Message | Masahiko Sawada | 2026-07-21 00:12:42 | pgsql: Add logical decoding status to pg_control_checkpoint(). |