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

From: Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Fujii Masao <masao(dot)fujii(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 05:18:30
Message-ID: CAJTYsWWmPrvTaVTuKtjXA84f3+PDVPitf5X91_QkuhOe-5Qaeg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On Fri, 21 Aug 2026 at 04:00, Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Wed, Aug 19, 2026 at 09:42:18PM +0530, Ayush Tiwari wrote:
> > On Wed, 19 Aug 2026 at 20:52, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> >> I think this should be backpatched to v18, where
> >> pg_restore_relation_stats() and pg_restore_attribute_stats() were
> >> introduced.
> >>
> >> Thought?
>
> 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.
>

FWIW I think it's more of a bug too rather than just improvement
some of the applications depend on the errcode PG emits
to give end results.

> Just a note: I've tried to be careful with assigning errcodes for all
> the new error paths of extended_stats_funcs.c added in v19 that can be
> reached by SQL. If there are holes in there, please let me know.
>
> > Found some more places where the issue exists and added
> > there. Maybe you can incorporate those too in your patch?
>
> 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).
>

Ahh atleast for 19629-31 I thought they shared the exact root cause
of not specified errcodes, and there were few more in the tree, but
I'm fine with the splitting part if needed.

Regards,
Ayush

In response to

Browse pgsql-bugs by date

  From Date Subject
Next 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
Previous Message Andrey Rachitskiy 2026-08-21 05:01:59 Re: BUG #19633: Unexpected results of IN (subquery) with a non-deterministic collation