Re: BUG #19531: Inconsistent Error Messages for the Same SQL Query - Mailing list pgsql-bugs

From Laurenz Albe
Subject Re: BUG #19531: Inconsistent Error Messages for the Same SQL Query
Date
Msg-id 51f55cfd0fc2e8f7534b486ffa55acfce912253c.camel@cybertec.at
Whole thread
In response to BUG #19531: Inconsistent Error Messages for the Same SQL Query  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Wed, 2026-06-24 at 07:20 +0000, PG Bug reporting form wrote:
> Environment:
> - PostgreSQL version: 18.4
> - Operating System: Ubuntu 22.04
>
> Context:
> My application relies on the error messages returned by SQL statement
> execution to perform subsequent operations. During development, I discovered
> that the same SQL query can return different error messages . I'm not sure
> if this is a bug, but it does affect my application's ability to reliably
> handle errors.

I would say that this is not a bug.

Your statement contains two errors and it depends on the execution plan
which of the two errors you are hitting first.  If your program reacts
differently based on the exact error, both reactions would be correct,
because both errors are present in the query.

I would compare the situation to an INSERT statement into a table with
two constraints.  Depending on which data are present in the database,
you could hit a constraint violation error for either constraint.

Yours,
Laurenz Albe



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #19531: Inconsistent Error Messages for the Same SQL Query
Next
From: Francisco Olarte
Date:
Subject: Re: BUG #19531: Inconsistent Error Messages for the Same SQL Query