pg_dump: Include column statistics for index-backed constraints

dumpIndex() emits ALTER INDEX .. SET STATISTICS for per-column
statistics targets, but dumpConstraint() never did.  Targets set on the
expression columns of an exclusion constraint's index were silently
lost on dump/restore and pg_upgrade.

The same code can be used in the index and constraint dump code to
generate these ALTER INDEX commands.  The logic has been refactored so
that both share a new subroutine in charge of generating all these
custom SET STATISTICS, if any.

Oversight in e4fca461ab6f.

Author: Zsolt Parragi <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Reviewed-by: Andrew Krylosov <[email protected]>
Discussion: 
https://postgr.es/m/CAN4CZFMd9riOuV5LkM+uV=uf-hyp49c8fh22xwymxptglbc...@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a96a9e17064ba0e5ba08514c4055200edab2b29d

Modified Files
--------------
src/bin/pg_dump/pg_dump.c        | 88 +++++++++++++++++++++-------------------
src/bin/pg_dump/t/002_pg_dump.pl | 25 ++++++++++++
2 files changed, 72 insertions(+), 41 deletions(-)

Reply via email to