Re: Simplify code building the LR conflict messages

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Simplify code building the LR conflict messages
Date: 2025-11-28 03:49:10
Message-ID: CAHut+Pv93qX22M3QMYYmZ+uSAmpwCuyHfvGoHU1ATthD-Jkwyg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 28, 2025 at 1:49 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Peter Smith <smithpb2250(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2025-11-28 03:59:01 Fix a recent "shadow warning" in subscriptioncmds.c
Previous Message Thomas Munro 2025-11-28 03:41:46 Minor LLVM cleanups