Re: Add expressions to pg_restore_extended_stats()
Corey Huinker <corey.huinker@gmail.com>
From: Corey Huinker <corey.huinker@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Chao Li <li.evan.chao@gmail.com>, Tender Wang <tndrwang@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Tomas Vondra <tomas@vondra.me>
Date: 2026-02-09T07:25:49Z
Lists: pgsql-hackers
> > By the way, the test you have proposed in [1] to copy the expression > stats from an origin to a target and check the differences was super > nice. Could you add that back, with 'exprs' set as a jsonb blob? > This was posted in 0003, but got cut due to the initial integration of > the feature without expressions. > +1 > I have put my hands on the patch, and fixed all these issues, adding > tests to cover the holes I have spotted, and addressed a lot of > stylistic things. I did not take the time to add the diff test, > though when the expressions are cloned. Could you? > +1 > The cases of STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM and > STATISTIC_KIND_BOUNDS_HISTOGRAM are a bit sad. How about exposing > them into pg_stats_ext_exprs as a first patch, then extend the > expression restore function to be able to work on them? Modifying the > view would be an entirely independent thing. Please note that I do > not mind skipping these two cases for now, the proposed patch is > already doing a lot. Still if we are able to close entirely the loop > for this release that would be nice. Anyway, let's keep this stuff as > separate patches on top of this v8 and future reviewed versions. > I was thinking of doing exactly that, with a lot of language around how these extra patches don't need to make it into v19. But having said that, they'll probably be pretty small.
Commits
-
Refactor tests for catalog diff comparisons in stats_import.sql
- ccd7abaa456f 19 (unreleased) landed
-
Fix typo in stats_import.sql
- 9e8193a26229 19 (unreleased) landed
-
Add support for "exprs" in pg_restore_extended_stats()
- ba97bf9cb7b4 19 (unreleased) landed
-
Add information about range type stats to pg_stats_ext_exprs
- 307447e6dbc0 19 (unreleased) landed
-
Fix comment in extended_stats_funcs.c
- 9476ef206c64 19 (unreleased) landed