pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Report specific SQLSTATEs for stats restore errors
Date: Thu, 27 Aug 2026 14:43:23 +0000
Message-ID: <E1wzbK6-00000002Lu4-01l5@gemulon.postgresql.org> (raw)

Report specific SQLSTATEs for stats restore errors

The pg_restore_*_stats() functions could report SQLSTATE XX000 for
invalid variadic arguments, such as an unmatched name/value pair, a NULL
argument name, or a non-text argument name. Attribute and extended
statistics restores could also report XX000 when the supplied statistics
exceed the number of slots PostgreSQL can store.

These are not internal errors. They result from invalid caller input or
a PostgreSQL implementation limit, but the lack of specific SQLSTATEs
made clients treat them as internal errors.

Assign appropriate SQLSTATEs to these errors so that applications and
tests can classify them correctly.

Backpatch to v19, but no further; changing ERRCODE assignments in
released stable branches doesn't seem like a good idea.

Bug: #19629
Reported-by: Zheng Wang <hackerzheng666@gmail.com>
Reported-by: Yanjie Zhao
Reported-by: Yiyang Liu
Author: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/19629-76babc04b683594d@postgresql.org
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4c5291435d40a0cf02b131b680a71e42243fcd04

Modified Files
--------------
src/backend/statistics/stat_utils.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)



view thread (2+ messages)

Message-ID: <E1wzbK6-00000002Lu4-01l5@gemulon.postgresql.org>
Permalink:  ../E1wzbK6-00000002Lu4-01l5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wzbK6-00000002Lu4-01l5@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: fujii@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Report specific SQLSTATEs for stats restore errors
  In-Reply-To: <E1wzbK6-00000002Lu4-01l5@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox