Re: BUG #19715: pg_restore_attribute_stats() rejects range statistics for a domain over int4multirange

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, imchifan(at)163(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19715: pg_restore_attribute_stats() rejects range statistics for a domain over int4multirange
Date: 2026-09-24 23:46:23
Message-ID: arW2T9Oa5k6Wpq-O@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Sep 25, 2026 at 07:52:07AM +0900, Michael Paquier wrote:
> Yes, I was wondering about that a bit, feeding a single typcache entry
> across the board. And while looking at the code, I was reminded about
> the following exceptions:
> extended_stats_funcs.c: if (typid == TSVECTOROID)
> stat_utils.c: if (*atttypid == TSVECTOROID)
> stat_utils.c: if (atttypid == TSVECTOROID)
>
> I think that the existing code is also broken when defining a domain
> over tsvector if we don't feed a domain base type in these three
> spots.

With all that in mind, I am getting down to the point that we should
accept that the early stages of attribute and extended stats restore
should try to fetch the typcache data of the base types, then roll it
around. This leads to the attached, taking care of the range,
multirange and tsvector cases.

I'd certainly welcome more eyes here. Please note that this applies
on HEAD cleanly, and should mostly apply cleanly on v19. The v18
flavor would be much more localized, of course.
--
Michael

Attachment Content-Type Size
v2-0001-Fix-import-of-statistics-for-domains-over-multi-r.patch text/plain 38.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-24 23:46:46 Re: autovacuum: automatically propagate updated parameters
Previous Message Michael Paquier 2026-09-24 22:52:07 Re: BUG #19715: pg_restore_attribute_stats() rejects range statistics for a domain over int4multirange