Re: Question on error code selection in conflict detection - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Question on error code selection in conflict detection
Date
Msg-id CAA4eK1+xZPJT1iM2Zz8fLdp-pbnBbR=WcAj9-yDa5_0=7yFaFQ@mail.gmail.com
Whole thread Raw
In response to Re: Question on error code selection in conflict detection  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, Jun 12, 2025 at 6:56 PM Robert Haas <robertmhaas@gmail.com> wrote:
>
> On Thu, Jun 12, 2025 at 3:09 AM Amit Kapila <amit.kapila16@gmail.com> wrote:
> > cases like UPDATE_MISSING, DELETE_MISSING, the existing code
> > ERRCODE_NO_DATA_FOUND seems to be an exact match. The LOG message
> > appears when we don't find the row to be updated or deleted while
> > applying changes. This can happen if someone deletes the required rows
> > on the subscriber. This case is similar to unique_key_violation where
> > we report ERRCODE_UNIQUE_VIOLATION when, during apply, we found the
> > row with the same key exists (for example, cases like INSERT_EXISTS or
> > UPDATE_EXISTS). So, I can't think of a reason to use a different
> > error_code for these cases.
>
> Well, ERRCODE_NO_DATA_FOUND is "Class P0 - PL/pgSQL Error," and it
> normally occurs when STRICT was used to say that SELECT INTO should
> return exactly one row. This is a completely different part of the
> system and a completely different situation. I see that one use of
> ERRCODE_NO_DATA_FOUND has also found its way into tablecmds.c, but
> that is probably also a mistake that should be fixed.
>

Right, and I agree we should work on changing the use of error code
ERRCODE_NO_DATA_FOUND in tablecmds.c.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Suggestions for improving \conninfo output in v18
Next
From: Shubhankar Anand Kulkarni
Date:
Subject: Re: Expression push down from Join Node to below node.