pgsql: pg_dump: scope indAttNames per index in getIndexes()

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_dump: scope indAttNames per index in getIndexes()
Date: 2026-06-03 10:01:44
Message-ID: E1wUiPw-000skK-1s@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

pg_dump: scope indAttNames per index in getIndexes()

getIndexes() declared indAttNames and nindAttNames in the outer
per-table loop, so the names collected for an index on expressions
were carried over to the next plain index in the same table.

This is an internal inconsistency rather than a user-facing bug.
dumpRelationStats_dumper() only walks indexes that have pg_statistic
rows, and ANALYZE only creates those for indexes with expressions,
so the second index in the affected pair is not visited and the stale
array is never consulted.

Fix by moving the two variables into the inner per-index loop so each
iteration starts with a clean slate.

Author: Maksim Melnikov <m(dot)melnikov(at)postgrespro(dot)ru>
Reviewed-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Discussion: https://postgr.es/m/be5fc489-587e-421f-bbb8-adb43cfd50f4@postgrespro.ru
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/298bdd379552148f6043b4595374a7a6fbdd13c3

Modified Files
--------------
src/bin/pg_dump/pg_dump.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2026-06-03 10:01:45 pgsql: pg_dump: scope indAttNames per index in getIndexes()
Previous Message Fujii Masao 2026-06-03 09:49:44 pgsql: Fix race in ReplicationSlotRelease() for ephemeral slots