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

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: 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 05:56:29
Message-ID: CADkLM=ci+m6KW1r1RutSOV-OOvv9FTNrOU0+7wNq8R2+p-91Nw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Sep 24, 2026 at 12:22 AM Michael Paquier <michael(at)paquier(dot)xyz>
wrote:

> On Wed, Sep 23, 2026 at 03:02:30PM -0400, Corey Huinker wrote:
> > I'm looking into this.
>
> I have begun looking at this before you had sent this reply, and we
> are handling the base type of a domain in an incorrect way, assuming
> that for attribute and extended stats we should just always check for
> TYPTYPE_[MULTI]RANGE, but domains don't map with that at all. I think
> that we are missing an extra getBaseType(), like
> [multi]range_typanalyze(), where we use a [multi]range_get_typcache()
> to cope with domains (getBaseTypeAndTypmod() does the job in the
> typcache). That's also mentioned in the code.
>
> And the same can be said for expressions in extended stats where a
> domain that has a [multi]range type is involved. We would be better
> getting rid of these hardcoded TYPTYPE values, IMO.
>
> Spoiler: the tests are boring, still required. And fortunately, the
> only damage is stats data not restored but skipped. Annoying, but not
> as annoying as in the class of problems labelled like "I corrupt the
> catalogs".
>
> What do you think?
> --
> Michael
>

Here's what I was just about to post to the list, only to see that you
already posted something.

Will begin reviewing yours immediately.

Attachment Content-Type Size
v1-0001-Fix-import-of-range-statistics-for-domains.patch text/x-patch 16.8 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Corey Huinker 2026-09-24 06:13:56 Re: BUG #19715: pg_restore_attribute_stats() rejects range statistics for a domain over int4multirange
Previous Message Nikolay Samokhvalov 2026-09-24 04:44:54 Re: autovacuum: automatically propagate updated parameters