Simplify code building the LR conflict messages

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Simplify code building the LR conflict messages
Date: 2025-11-28 01:34:14
Message-ID: CAHut+Psgkwy5-yGRJC15izecySGGysrbCszv_z93ess8XtCDOQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While reviewing another conflict-related thread, I noticed that the
existing conflict messages are currently getting built using
unexpected logic.

e.g
----------
if (tuple_value.len > 0)
{
appendStringInfoString(&tuple_value, "; ");
appendStringInfo(&tuple_value, _("existing local row %s"),
desc);
}
else
{
appendStringInfo(&tuple_value, _("Existing local row %s"),
desc);
}
----------

I couldn't think of a reason why the "; " string needed to be
separated from the rest of the message like that. And when you combine
the strings, the logic easily collapses into a single statement with
less code and greater readability.

There were several code fragments like this. Here is a patch to modify them.

Thoughts?

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment Content-Type Size
v1-0001-Simplify-the-code-building-the-conflict-messages.patch application/octet-stream 2.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-11-28 02:15:03 Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication
Previous Message Michael Paquier 2025-11-28 00:46:07 Re: Refactoring: Use soft error reporting for *_opt_overflow functions of date/timestamp