pg_dump: ALTER INDEX SET STATISTICS missing for index-backed constraints

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: pg_dump: ALTER INDEX SET STATISTICS missing for index-backed constraints
Date: 2026-07-14 12:45:04
Message-ID: CAN4CZFMd9riOuV5LkM+uV=uF-HYp49C8Fh22xWyMxptGLBCZ3A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello hackers,

I noticed this while reviewing the pg_get_tale_ddl patch and looking
for inconsistencies compared to pg_dump.

It seems like pg_dump emits SET STATISTICS for most cases since 2018
(e4fca461), but it was missed in this case:

CREATE TABLE t (a int, b int);
ALTER TABLE t ADD CONSTRAINT name EXCLUDE USING gist ((a+b) WITH =);
ALTER INDEX name ALTER COLUMN 1 SET STATISTICS 900;

The last statement was missing from the pg_dump output.

Attached patch fixes it and adds a test case.

Attachment Content-Type Size
0001-Dump-index-column-statistics-for-index-backed-constr.patch application/octet-stream 3.3 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-07-14 12:49:35 Re: walsummarizer can get stuck when switching timelines
Previous Message Andrey Borodin 2026-07-14 12:40:55 Re: walsummarizer can get stuck when switching timelines