pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Corey Huinker <corey.huinker@gmail.com>
Cc: 303677365@qq.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19842: pg_restore_extended_stats() rejects a faithful pg_dump of ANALYZE-produced range expression statisti
Date: Fri, 13 Nov 2026 15:02:28 +0900
Message-ID: <avan9H8xvnx9F2iG@paquier.xyz> (raw)
In-Reply-To: <CADkLM=fBn3KkGu1H0oEnUxiUydVtwk5jhdeqbX0DkgfZAV0ejQ@mail.gmail.com>
References: <19842-ca042326dd2430a4@postgresql.org>
	<avFaBdhb4ONGhIjH@paquier.xyz>
	<CADkLM=fvGCQWvrrDrSB2M7PHYS=PwLGU17LzoYE6u23t3KV5gQ@mail.gmail.com>
	<avKVFEGuLRlhdTyp@paquier.xyz>
	<CADkLM=ftnV12NmWVMD4NFVpHqFJCwdUr73QsLp=Byuz4f4bS+g@mail.gmail.com>
	<avUXrITj4oE5SO9t@paquier.xyz>
	<CADkLM=fBn3KkGu1H0oEnUxiUydVtwk5jhdeqbX0DkgfZAV0ejQ@mail.gmail.com>

On Thu, Nov 12, 2026 at 04:07:54PM -0500, Corey Huinker wrote:
> 0001 -
> Decoupling range_bounds_histogram. No changes since last patchset where it
> was number 0002.

Ah, I see what you are getting at here.  Without this part a portion
of 0003 is actually moot, and the reason where there is no point to
check for range_bounds_histogram in parallel of range_length_histogram
and range_empty_frac is that they use a different stats slot.

Tweaked a few things here, and applied down to v19.

> 0002 -
> 
> Fix to pg_dump to handle NULL values in range_length_histogram and
> most_common_elems when their corresponding stanumbers field is not null.
> 
> I was able to test this against 18, however I [1] was not able to
> synthesize data such that an extended statistics object on 18 that had
> expression stats with a NULL most_common_elems and NOT NULL
> most_common_elem_freqs. I asked Claude to try to do it as well, and it too
> was not able to.

I have not been able to process this one today, unfortunately.  I had
to choose what to do, and picked up the most important matters based
on their priority.

> 0003 -
> This has the same goals as the original 0003, but using the methods laid
> out in 2656f664616d.

While the code changes were fine, to allow for empty arrays like in
2656f664616d, the tests were bundled at the bottom of
stats_import.sql.  We have already sections of the tests that check
similar patterns, so I have just moved the whole in sections that are
more adapted for this goal.  Applied also this one, after some edits.

Should we also include a test where empty arrays are allowed but we
have a multi-dimension array in input?  I have refrained from doing so
to not complicate more the patch and there were enough tests to check
for the basics in terms of v19.  Your patch did not do that, either.

0001 and 0003 were by far the most urgent items to handle for v19 (and
actually the less risky ones).  Without 0002 for the moment, it still
means that we could miss some stats at dump/restore due to the
NULL/empty change introduced in v19 when upgrading from v17/18, but at
least we are clear for any future moves, or when doing a dump from
v19.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (10+ messages)  latest in thread

Message-ID: <avan9H8xvnx9F2iG@paquier.xyz>
Permalink:  ../avan9H8xvnx9F2iG@paquier.xyz/
Also on:    postgresql.org/message-id/avan9H8xvnx9F2iG@paquier.xyz

 · 

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 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, corey.huinker@gmail.com, 303677365@qq.com
  Subject: Re: BUG #19842: pg_restore_extended_stats() rejects a faithful pg_dump of ANALYZE-produced range expression statisti
  In-Reply-To: <avan9H8xvnx9F2iG@paquier.xyz>
  References: <19842-ca042326dd2430a4@postgresql.org> <avFaBdhb4ONGhIjH@paquier.xyz> <CADkLM=fvGCQWvrrDrSB2M7PHYS=PwLGU17LzoYE6u23t3KV5gQ@mail.gmail.com> <avKVFEGuLRlhdTyp@paquier.xyz> <CADkLM=ftnV12NmWVMD4NFVpHqFJCwdUr73QsLp=Byuz4f4bS+g@mail.gmail.com> <avUXrITj4oE5SO9t@paquier.xyz> <CADkLM=fBn3KkGu1H0oEnUxiUydVtwk5jhdeqbX0DkgfZAV0ejQ@mail.gmail.com> <avan9H8xvnx9F2iG@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