pgsql: pg_dump: Include column statistics for index-backed constraints

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_dump: Include column statistics for index-backed constraints
Date: 2026-10-02 08:03:47
Message-ID: E1xCYF9-000000026PQ-2ml2@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 <zsolt(dot)parragi(at)percona(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Andrew Krylosov <krylosov(dot)andrew(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAN4CZFMd9riOuV5LkM+uV=uF-HYp49C8Fh22xWyMxptGLBCZ3A@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

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

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

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2026-10-02 08:16:37 pgsql: pgindent: Keep the alignas() placeholder the same width
Previous Message Michael Paquier 2026-10-02 01:47:59 pgsql: Fix crash when describing a FETCH statement whose cursor is gone