Re: Simplify code building the LR conflict messages

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Peter Smith <smithpb2250(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Simplify code building the LR conflict messages
Date: 2026-01-16 06:52:50
Message-ID: CAJpy0uBef9erMtieHKgu78G7fdT-WXcCgGLMjdP9uSZV4DmrBw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Kuroda-San, I looked at the code. Currently it is slightly
complicated. Can we please simplify it by removing different
message-styles for a single conflict. For example
MULTIPLE_UNIQUE_CONFLICTS has below:

1)
When key and local rows are there:
"Key %s already exists in unique index \"%s\", modified locally in
transaction %u at %s: local row %s.

When key is not there:
"Unique index \"%s\" rejects applying due to local row %s, modified
locally in transaction %u at %s."

When local row is not there:
"Key %s already exists in unique index \"%s\", modified locally in
transaction %u at %s."

When both key and local row is not there:
Remote row violates unique constraint \"%s\", modified locally in
transaction %u at %s."

Can we try to construct message like this: (both key value and local
row at the end)
Key already exists in unique index "conf_tab_pkey", modified locally
in transaction <..> at <...>: Key (a)=(2), local row (2, 2, 2),

We can keep the message same for all 4 cases above.

2)
Also there are many if-else blocks around the below type of message as well:
DETAIL: Could not find the row to be updated by using replica
identity (i)=(30): remote row (30, 300).

If we instead have this:
DETAIL: Could not find the row to be updated: replica identity
(i)=(30), remote row (30, 300).

Will it simplify the code, can you please check?

thanks
Shveta

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-01-16 06:53:42 Re: [PATCH] remove incorrect comment in pg_resetwal.c
Previous Message Michael Paquier 2026-01-16 06:50:50 Re: Extended Statistics set/restore/clear functions.