Re: Question on error code selection in conflict detection

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Question on error code selection in conflict detection
Date: 2025-06-13 09:58:42
Message-ID: CAA4eK1+xZPJT1iM2Zz8fLdp-pbnBbR=WcAj9-yDa5_0=7yFaFQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 12, 2025 at 6:56 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Thu, Jun 12, 2025 at 3:09 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2025-06-13 12:35:44 Re: Allow pg_dump --statistics-only to dump foreign table statistics?
Previous Message Fujii Masao 2025-06-13 09:52:26 Re: Suggestions for improving \conninfo output in v18