Re: Proposal: Conflict log history table for Logical Replication

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: vignesh C <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(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>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: Proposal: Conflict log history table for Logical Replication
Date: 2026-08-27 09:42:03
Message-ID: CAJpy0uAhGuVXL1erfsvrtb53bJWh_x=M26EK-dxzPJXXHoRBJg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 26, 2026 at 5:54 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> > Using NULL for local_conflicts in the latter two cases would make the
> > column's semantics clearer and the output easier for users to query.

Regarding the fix done for above:

insert_conflict_log_tuple:
+ * In update_missing and delete_missing conflicts, there are no local
+ * conflicting rows, so set local_conflicts to NULL.
*/
+ if (conflict_type != CT_UPDATE_MISSING &&
+ conflict_type != CT_DELETE_MISSING)
+ values[attno++] = build_local_conflicts_json_array(conflicttuples);
+ else
+ nulls[attno++] = true;

I think a better way to handle this would be to have conflicttuples
reach here as NULL for these two conflict types, rather than
hard-coding the behavior here. If we pass conflicttuples as NULL to
ReportApplyConflict() for the these 2 conflicts from
apply_handle_update_internal() and apply_handle_delete_internal(), we
should be good IMO. ReportApplyConflict() and
errdetail_apply_conflict() don't actually use conflicttuples for these
two conflict types, so passing it as NULL should work. But I might
overlook something, so please give it a try once.

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikhil Sontakke 2026-08-27 09:45:18 Re: [PATCH] Fix JSON_SERIALIZE() coercion placeholder type for jsonb input
Previous Message Chao Li 2026-08-27 09:21:45 Re: tablecmds: fix bug where index rebuild loses replica identity on partitions