Re: BUG #19821: pg_restore_attribute_stats() accepts an unsorted scalar histogram_bounds, producing badly wrong row

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: mingjie gao <mingjie(dot)gmj(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, 303677365(at)qq(dot)com
Subject: Re: BUG #19821: pg_restore_attribute_stats() accepts an unsorted scalar histogram_bounds, producing badly wrong row
Date: 2026-10-31 00:19:57
Message-ID: auU0LUfLX990VMRc@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2026-10-31 00:26:18 Re: BUG #19814: pg_restore_attribute_stats: MCV accepted without eq operator; ANALYZE range slot rejected
Previous Message Tom Lane 2026-10-30 21:41:46 Re: BUG #19809: oidvector index dedup still returns wrong results on 18.6; CTAS persists the corrupted rows