Add functions pg_restore_relation_stats(), pg_restore_attribute_stats(). Similar to the pg_set_*_stats() functions, except with a variadic signature that's designed to be more future-proof. Additionally, most problems are reported as WARNINGs rather than ERRORs, allowing most stats to be restored even if some cannot.
These functions are intended to be called from pg_dump to avoid the need to run ANALYZE after an upgrade. Author: Corey Huinker Discussion: https://postgr.es/m/CADkLM=eergzn7ecdpwfcptjkok9sxzek5pot4d94evtzsvj...@mail.gmail.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d32d1463995c036853eeb9ec99cc367ffc7794ae Modified Files -------------- doc/src/sgml/func.sgml | 100 +++ src/backend/statistics/attribute_stats.c | 19 + src/backend/statistics/relation_stats.c | 60 +- src/backend/statistics/stat_utils.c | 126 ++++ src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 20 +- src/include/statistics/stat_utils.h | 5 + src/test/regress/expected/stats_import.out | 955 +++++++++++++++++++++++++++-- src/test/regress/sql/stats_import.sql | 696 ++++++++++++++++++++- 9 files changed, 1891 insertions(+), 92 deletions(-)