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

Поиск
Список
Период
Сортировка
Искать

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

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
Вложения:
On Wed, Aug 19, 2026 at 6:24 PM PG Bug reporting form
 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?

Regards,

-- 
Fujii Masao
FAQ