Simplify code building the LR conflict messages - Mailing list pgsql-hackers

From Peter Smith
Subject Simplify code building the LR conflict messages
Date
Msg-id CAHut+Psgkwy5-yGRJC15izecySGGysrbCszv_z93ess8XtCDOQ@mail.gmail.com
Whole thread Raw
Responses Re: Simplify code building the LR conflict messages
List 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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Refactoring: Use soft error reporting for *_opt_overflow functions of date/timestamp
Next
From: Fujii Masao
Date:
Subject: Re: pg_recvlogical: Prevent flushed data from being re-sent after restarting replication