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

From Peter Smith
Subject Re: Simplify code building the LR conflict messages
Date
Msg-id CAHut+Pv93qX22M3QMYYmZ+uSAmpwCuyHfvGoHU1ATthD-Jkwyg@mail.gmail.com
Whole thread Raw
In response to Re: Simplify code building the LR conflict messages  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Simplify code building the LR conflict messages
List pgsql-hackers
On Fri, Nov 28, 2025 at 1:49 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Smith <smithpb2250@gmail.com> writes:
> > 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.
>
> ... and, probably, less ability of the compiler to verify that the
> variadic arguments match the format string.  I think you've taken
> this a bit too far.
>

Hi Tom,

Thank you for the feedback. Could you please clarify which aspect is
of concern so I can address it properly:

* Is the concern about having a StringInfo format string that starts
with a semicolon? If so, I noticed there are already multiple similar
examples in the codebase (see: `grep -r . -e 'StringInfo(.*";.*%'`),
so I understood this pattern to be acceptable.

* Or is it the use of the ternary operator to select the format
string? If that's the issue, please note that my patch only introduced
the ternary operator for the first two code fragments. The third
fragment already uses ternaries in the same way on master, so I
understood that to be an established pattern as well.

I'd like to make sure I understand your concern correctly so I can
revise the patch appropriately.

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



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Minor LLVM cleanups
Next
From: Peter Smith
Date:
Subject: Fix a recent "shadow warning" in subscriptioncmds.c