| From: | Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com> |
|---|---|
| To: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com> |
| Cc: | 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-20 09:06:41 |
| Message-ID: | CAJTYsWVY5_X2+7JO=Mr9z9iNzxbL9qFW-1hTHWkT0wUfq3cgNw@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
Hi,
On Wed, 19 Aug 2026 at 21:42, Ayush Tiwari <ayushtiwari(dot)slg01(at)gmail(dot)com>
wrote:
> Hi,
>
> On Wed, 19 Aug 2026 at 20:52, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>
>> On Wed, Aug 19, 2026 at 6:24 PM PG Bug reporting form
>> <noreply(at)postgresql(dot)org> wrote:
>> > Suggested fix: add errcode() to each ereport call
>> > (ERRCODE_INVALID_PARAMETER_VALUE,
>> > ERRCODE_NULL_VALUE_NOT_ALLOWED, ERRCODE_DATATYPE_MISMATCH
>> respectively).
>>
>> Thanks for the report and suggestion!
>>
>> I agree that these errors should not be reported with SQLSTATE XX000.
>> Attached is a patch that assigns specific SQLSTATEs to these cases.
>>
>> The first three use the error codes you suggested. For the fourth case,
>> "maximum number of statistics slots exceeded", I used
>> ERRCODE_PROGRAM_LIMIT_EXCEEDED rather than
>> ERRCODE_INVALID_PARAMETER_VALUE. This is caused by PostgreSQL's fixed
>> limit on pg_statistic slots, so PROGRAM_LIMIT_EXCEEDED seemed more
>> appropriate.
>>
>> I think this should be backpatched to v18, where
>> pg_restore_relation_stats() and pg_restore_attribute_stats() were
>> introduced.
>>
>> Thought?
>>
>
> Thanks for the patch, Fujii-san!
>
> I had posted a patch for all the three related bugs at [0]
>
> Found some more places where the issue exists and added
> there. Maybe you can incorporate those too in your patch?
>
Updating link for [0] to the all-in [19629-19632 thread]
Regards,
Ayush
[0]
https://www.postgresql.org/message-id/CAJTYsWUuL1cvBrameN2r-n6k8Ju8nqymJVeamaf%2B1FDneTxRLw%40mail.gmail.com
<https://www.postgresql.org/message-id/CAJTYsWUuL1cvBrameN2r-n6k8Ju8nqymJVeamaf%2B1FDneTxRLw%40mail.gmail.com>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-08-20 11:17:53 | Re: Possible G2-item at SERIALIZABLE |
| Previous Message | Ayush Tiwari | 2026-08-20 08:58:17 | Re: BUG #19632: RULE rewriting crashes with XX000 when RETURNING old/new references a system column |