So, I have done more work on all that, and extracted two more pieces, applying them: - The bits for dependencies in the restore function, . - The pg_dump bits for dependencies and n_distinct, as of c32fb29e979d. It was sad here that your posted patch did not use the keys of statistics_format.h. A comment was also missing in AdjustUpgrade.pm, where the code will be able to handle the "version" tag included in the dumps.
Hooray!
Another thing that I strongly suspect is going to break in the buildfarm are the cross-version upgrades, because the format of the pg_dependencies and pg_ndistinct is not completely portable.
We had a similar rocky experience with pg_restore_relation_stats(), so your concerns are warranted.
This is a filter similar to the "version" field, except that we would replace all the contents of the pg_ndistinct and pg_dependencies values inside single quotes, protecting the dump comparisons for the new and old versions. Let's see first what the buildfarm says and if I need to pull this switch.
+1
And it means that at this point we are feature-complete for these two stats kinds, so there will be at least something for this release even if MCV and expressions don't make it. Still, the other pieces should be slightly easier to integrate now that the core parts have been added. -- Michael
And here's a rebased set
0001 - adds a test left out of dependencies
0002 - mcv (plus pgdump)
0003 - exprs (plus pgdump)
0004 - capstone set-difference test that could not have succeeded until all stat kinds were implemented.