Re: Simplify code building the LR conflict messages

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Peter Smith <smithpb2250(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Simplify code building the LR conflict messages
Date: 2025-11-29 07:12:27
Message-ID: CAA4eK1Lq-00Gd4UYmvBaywSpZjXcrd5Yw8H_zvVQU+dZwHTL8w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 28, 2025 at 6:38 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> 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.
>
> and then we add whatever this function produces, after a newline. I
> don't remember any other place in our code that does such a thing. The
> result would look something like
>
> DETAIL: The row to be updated was deleted.
> Key: (1, 2); remote row (1,2,3); replica identity full (1,2,3).
>
> or something like that, where each of the parts can begin with uppercase
> or not, with a semicolon or not, depending on whether there are any
> previous parts.
>
> I wonder if it would make more sense to move this identifying
> information to a CONTEXT line instead, where we won't have to care about
> the uppercase.
>

As per my understanding, we typically display the information in
context via errcontext() in error context callback functions which may
not be immediately available at the location where error happens. For
example, while applying the remote changes, the error can happen
anywhere in the heap or below layer, but we add additional apply
related information (like which apply_message was being processed when
error occurred) via apply_error_callback. So, it is not clear in the
case at hand whether we should display the information which is
available at error_site via context message.

--
With Regards,
Amit Kapila.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Miłosz Bieniek 2025-11-29 11:07:05 Re: [PATCH] Add `headerscheck` run_target to meson
Previous Message Amit Kapila 2025-11-29 06:33:40 Re: Remove unused function parameters, part 2: replication