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 <[email protected]>
Reviewed-by: Matthias van de Meent <[email protected]>
Backpatch-through: 15
Discussion: 
https://postgr.es/m/cacjufxgwvb6dwpaqz25exm-sdcxownfbfthud5wg41-zdcg...@mail.gmail.com

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/83899750ee7ae3d4f0ed1832253fc06a1f527a78

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

Reply via email to