Re: BUG #19531: Inconsistent Error Messages for the Same SQL Query

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: 1804981203(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19531: Inconsistent Error Messages for the Same SQL Query
Date: 2026-06-24 08:19:52
Message-ID: 51f55cfd0fc2e8f7534b486ffa55acfce912253c.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Francisco Olarte 2026-06-24 08:20:59 Re: BUG #19531: Inconsistent Error Messages for the Same SQL Query
Previous Message PG Bug reporting form 2026-06-24 07:20:28 BUG #19531: Inconsistent Error Messages for the Same SQL Query