pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexander Korotkov <akorotkov@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_dump: scope indAttNames per index in getIndexes()
Date: Wed, 03 Jun 2026 10:01:45 +0000
Message-ID: <E1wUiPx-000skj-1f@gemulon.postgresql.org> (raw)

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.melnikov@postgrespro.ru>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Discussion: https://postgr.es/m/be5fc489-587e-421f-bbb8-adb43cfd50f4@postgrespro.ru
Backpatch-through: 17

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/94c02de89c2632eeb870899c89224ca1a23d2ae1

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



view thread (4+ messages)  latest in thread

Message-ID: <E1wUiPx-000skj-1f@gemulon.postgresql.org>
Permalink:  ../E1wUiPx-000skj-1f@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wUiPx-000skj-1f@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: akorotkov@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_dump: scope indAttNames per index in getIndexes()
  In-Reply-To: <E1wUiPx-000skj-1f@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox