pgsql: Use indnkeyatts, not indnatts, in infer_collation_opclass_match(

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use indnkeyatts, not indnatts, in infer_collation_opclass_match(
Date: 2026-11-25 17:48:44
Message-ID: E1xWH6q-00000000IRs-3LmM@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use indnkeyatts, not indnatts, in infer_collation_opclass_match()

rd_indcollation, rd_opfamily and rd_opcintype only have entries for key
columns, so loops that read them must be bounded by indnkeyatts, not
indnatts. The function patched here was neglected in commit
386e3d7609c4 "CREATE INDEX ... INCLUDING (column[, ...])" dated April
2016; backpatch all the way back.

Author: Jian He <jian(dot)universality(at)gmail(dot)com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Backpatch-through: 15
Discussion: https://postgr.es/m/CACJufxGWVB6dwPaQz25eXm-sdcxOWNfbfTHUd5wG41-zDcG6OA@mail.gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/23fdc943245404c09869c8281d8295a80c134196

Modified Files
--------------
src/backend/commands/analyze.c | 4 ++++
src/backend/optimizer/util/plancat.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Masahiko Sawada 2026-11-25 18:31:37 pgsql: Use start LSN for transactional logical decoding messages.
Previous Message Álvaro Herrera 2026-11-25 16:32:36 pgsql: Clarify final phase of concurrent mode in comment