Re: BUG #19629: pg_restore_relation_stats reports XX000 instead of proper SQLSTATE for input validation errors

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>, hackerzheng666(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19629: pg_restore_relation_stats reports XX000 instead of proper SQLSTATE for input validation errors
Date: 2026-08-21 08:41:47
Message-ID: CAHGQGwG4aJ8xpjGphoW3e0-TA1MSXOcYnarMQ2dKWrVJQjtYTw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Aug 21, 2026 at 7:30 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> Adding an errcode() is a life improvement thing. So, while I agree
> that the proposed patch is an improvement, I don't see a strong need
> for a backpatch. Feel free to override this argument as you feel, of
> course.

I understand your point, but I'm inclined to backpatch this to v18.

These are input-validation errors that are directly reachable from SQL,
and the SQLSTATE is exposed to applications. Since applications commonly
branch on SQLSTATE, reporting XX000 makes these errors look like internal
errors rather than invalid input. That seems more like a bug than
a cosmetic improvement to me.

Also, these functions were introduced in v18, so the risk of breaking
existing applications that depend on the current XX000 behavior should
be low. For these reasons, I think backpatching to v18 is preferable here.
Thoughts?

But, on the other hand, if we want to avoid breaking existing
applications that depend on the current XX000 behavior, backpatching
to v19 might be a reasonable alternative.

> I'd suggest to keep things isolated in their own fashion, as they
> address different areas with slightly different user-changes changes
> (okay, not much).

+1

Regards,

--
Fujii Masao

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-08-21 09:02:26 BUG #19635: Missing entry in information_schema.sequences when creating a Tale with auto increment
Previous Message Fujii Masao 2026-08-21 07:55:43 Re: BUG #19598: pg_waldump: -s/-e accept out-of-range WAL locations and silently use the low 32 bits