Re: Simplify code building the LR conflict messages

2025-11-29 Thread Tom Lane
I wrote: > So I think this area desperately needs significant editorial > attention, as well as some fundamental rethinking of just what > information we should show. Perhaps using errcontext would help, > but I'm not sure. I think a large part of the problem stems from > trying to cram multiple

Re: Simplify code building the LR conflict messages

2025-11-29 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > So, what we're doing here is to append further row-identifying details > to an errdetail string that already contains some explanation of the > problem. That is, we have something like > DETAIL: The row to be updated was deleted. > and then we add whate

Re: Simplify code building the LR conflict messages

2025-11-28 Thread Amit Kapila
On Fri, Nov 28, 2025 at 6:38 PM Álvaro Herrera wrote: > > So, what we're doing here is to append further row-identifying details > to an errdetail string that already contains some explanation of the > problem. That is, we have something like > > DETAIL: The row to be updated was deleted. > > an

Re: Simplify code building the LR conflict messages

2025-11-28 Thread Álvaro Herrera
Hello, So, what we're doing here is to append further row-identifying details to an errdetail string that already contains some explanation of the problem. That is, we have something like DETAIL: The row to be updated was deleted. and then we add whatever this function produces, after a newli

Re: Simplify code building the LR conflict messages

2025-11-27 Thread Peter Smith
On Fri, Nov 28, 2025 at 3:27 PM Tom Lane wrote: > > Peter Smith writes: > > On Fri, Nov 28, 2025 at 1:49 PM Tom Lane wrote: > >> ... 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. > >

Re: Simplify code building the LR conflict messages

2025-11-27 Thread Tom Lane
Peter Smith writes: > On Fri, Nov 28, 2025 at 1:49 PM Tom Lane wrote: >> ... 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. > * Or is it the use of the ternary operator to select the forma

Re: Simplify code building the LR conflict messages

2025-11-27 Thread Peter Smith
On Fri, Nov 28, 2025 at 1:49 PM Tom Lane wrote: > > Peter Smith 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 co

Re: Simplify code building the LR conflict messages

2025-11-27 Thread Tom Lane
Peter Smith 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

Simplify code building the LR conflict messages

2025-11-27 Thread Peter Smith
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"),