Re: Proposal: Conflict log history table for Logical Replication

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, saurabh singh <saurabh(dot)singh214(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Conflict log history table for Logical Replication
Date: 2026-10-04 09:00:57
Message-ID: CAFiTN-u742n8OgykeLEF-kyp7L7CvYVOHRQj5iG0gntv2DYBtg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Oct 3, 2026 at 2:11 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Sun, Sep 27, 2026 at 11:32 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> >
> > There is one issue with the patch, the problem is that for some data
> > type index operator class type is different than actual table column
> > type,
> >
>
> Can you please share the test case as well showing this problem? We
> may even want to include that in the regression tests for this patch.

Here is the failed test case

-- On Publisher:
CREATE TABLE tab_temporal (
id int4range,
valid_at datemultirange,
PRIMARY KEY (id, valid_at WITHOUT OVERLAPS)
);
INSERT INTO tab_temporal VALUES ('[1,2)', '{[2020-01-01,2021-01-01)}');
CREATE PUBLICATION pub_temporal FOR TABLE tab_temporal;

-- On Subscriber:
CREATE TABLE tab_temporal (
id int4range,
valid_at datemultirange,
PRIMARY KEY (id, valid_at WITHOUT OVERLAPS)
);
CREATE SUBSCRIPTION sub_temporal
CONNECTION '...'
PUBLICATION pub_temporal
WITH (conflict_log_destination = 'table');

-- After initial sync, delete the row locally on the subscriber:
DELETE FROM tab_temporal;

-- Then delete the row on the publisher to trigger a
delete_missing conflict:
DELETE FROM tab_temporal;

And without fix shared as a v77-0003 [1], this would error out with
below error[2], I have explained the reason [1]. I have added a
testcase in 035_conflicts.pl file in v79-0003 patch for this issue.

[1] https://www.postgresql.org/message-id/CAFiTN-tfTqUbrMR2evE5H-wN3LQGgyDng-%3D3K%3DpJ%2Bsp%2BdAM5Hw%40mail.gmail.com

[2]
026-09-27 05:06:20.628 UTC [1278913] ERROR: type 4535 is not a range type
2026-09-27 05:06:20.628 UTC [1278913] CONTEXT: processing remote data
for replication origin "pg_16421" during message type "DELETE" for
replication target relation "public.tab_temporal" in transaction 674,
finished at 0/0179A648
2026-09-27 05:06:20.629 UTC [1277497] LOG: background worker "logical
replication apply worker" (PID 1278913) exited with exit code 1

--
Regards,
Dilip Kumar
Google

Attachment Content-Type Size
v79-0001-Implement-the-conflict-insertion-infrastructure-.patch application/octet-stream 81.4 KB
v79-0002-Don-t-use-row_to_json-or-record-oversized-values.patch application/octet-stream 22.4 KB
v79-0003-Use-table-tuple-descriptor-in-build_index_key_js.patch application/octet-stream 14.6 KB
v79-0004-top-up-patch-fix-for-v77-comments.patch application/octet-stream 4.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2026-10-04 09:17:11 Re: [PATCH] Refactor pgbench to make future improvements easier
Previous Message Manu 2026-10-04 08:25:06 Re: BUG #19686: Rolling back SET TABLESPACE