From: Michael Paquier <michael@paquier.xyz>
To: mingjie gao <mingjie.gmj@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org
Cc: 303677365@qq.com
Subject: Re: BUG #19821: pg_restore_attribute_stats() accepts an unsorted scalar histogram_bounds, producing badly wrong row
Date: Sat, 31 Oct 2026 09:19:57 +0900
Message-ID: <auU0LUfLX990VMRc@paquier.xyz> (raw)
In-Reply-To: <CAL5_ZS2gk8TxEaWNoJmxJty1akOniiWmG3WZUHnvft3J52VodA@mail.gmail.com>
References: <19821-0aa4084a3c6d9899@postgresql.org>
<CAL5_ZS2gk8TxEaWNoJmxJty1akOniiWmG3WZUHnvft3J52VodA@mail.gmail.com>
On Fri, Oct 30, 2026 at 02:50:28AM -0700, mingjie gao wrote:
> Given that discussion, getting bad row estimates from an unsorted
> histogram doesn't seem sufficient by itself to call this a bug.
In short, if the restore functions lead to one of the two following
problems, this may be something that should be adjusted:
- Crash of the backend, due to an incorrect loading of data.
- Assertion failure, where we may want to switch that to an
elog(ERROR) instead.
If no problem of this class happens and the only user-facing behavior
is that the planner goes crazy, there is nothing to do here. If any
problem in the lines of the previous two points can happen, please
prove that it is the case. range_bounds_histogram was leading to
a weird state of things when loading the data in line with these two
previous points. If this is also the case here, please show an
example of crash and/or assertion failure and/or elog() failure.
A elog() may not be worth tackling, the other two ones would be to me.
The original point that stats injection is a feature and not a bug
still stands, up to the point where the backend can hand its own and
not take down the whole server.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, mingjie.gmj@gmail.com, 303677365@qq.com
Subject: Re: BUG #19821: pg_restore_attribute_stats() accepts an unsorted scalar histogram_bounds, producing badly wrong row
In-Reply-To: <auU0LUfLX990VMRc@paquier.xyz>
References: <19821-0aa4084a3c6d9899@postgresql.org> <CAL5_ZS2gk8TxEaWNoJmxJty1akOniiWmG3WZUHnvft3J52VodA@mail.gmail.com> <auU0LUfLX990VMRc@paquier.xyz>
* 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