Re: Reject ill-formed range bounds histograms in pg_restore_attribute_stats()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Ewan Young <kdbase(dot)hack(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
Subject: Re: Reject ill-formed range bounds histograms in pg_restore_attribute_stats()
Date: 2026-07-07 08:27:08
Message-ID: aky4XN21qMYcTgsK@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 07, 2026 at 04:13:30PM +0800, Ewan Young wrote:
> pg_restore_attribute_stats() (and pg_set_attribute_stats()) stores a
> STATISTIC_KIND_BOUNDS_HISTOGRAM verbatim from user input, checking only
> that the argument is a one-dimensional, NULL-free array of the right
> type. It does not verify the invariant that ANALYZE's
> compute_range_stats() always establishes: the bounds histogram must
> contain no empty ranges, and its lower and upper bounds must each be
> sorted in ascending order.

I'll check that tomorrow. Thanks for the report.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Xuneng Zhou 2026-07-07 08:27:56 Re: BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64
Previous Message Amit Kapila 2026-07-07 08:24:44 Re: Proposal: Conflict log history table for Logical Replication