On Wed, Jan 28, 2026 at 08:51:54AM +0900, Michael Paquier wrote: > On Tue, Jan 27, 2026 at 11:14:12AM -0500, Corey Huinker wrote: > >> 0001 - adds a test left out of dependencies > > Applied this one now, you are right that it should have been added in > 302879bd68d1, so my mistake I guess.
This code in v32-0002 has given me a pause, because we define numexprs
and use it down the road for some input validation:
+ /* decode expression (if any) */
+ exprdatum = SysCacheGetAttr(STATEXTOID,
+ tup,
+ Anum_pg_statistic_ext_stxexprs,
+ &isnull);
+
+ if (!isnull)
+ {
[...]
+ }
+ numexprs = list_length(exprs);
Actually, I think that the patch split has been done incorrectly
because missing this code on HEAD also means that we do not perform a
correct validation of ndistinct and dependencies data when any of
these include expressions, because we are missing the negative
attribute numbers, numexprs remaining at 0 all the time. This can be
easily demonstrated with a statext object like that;
CREATE STATISTICS stats_obj (dependencies) ON lower(name), upper(name)
FROM tab_obj;
The restore function would reject input like that, but it should be
valid:
[{"attributes": [-1], "dependency": -2, "degree": 1.000000},
{"attributes": [-2], "dependency": -1, "degree": 1.000000}]
I'll go fix that now with some tests to cover things, after extracting
the relevant portion of the code from v32-0002.
--
Michael
signature.asc
Description: PGP signature
