model-writtenrun 4002 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported a Valgrind-detected invalid read when attaching a partition with an index, tracing it to CompareIndexInfo checking only one index's attribute number before accessing the attribute map #1.
- Michael Paquier proposed guarding the second index's attribute number as well, although his initial Valgrind run did not reproduce the error #2.
- Alexander Lakhin confirmed that Michael's fix worked and supplied a separate Valgrind testing harness #3; Michael identified USE_VALGRIND as the missing build option #4, and Alexander explained that his harness also covered TAP tests and other PostgreSQL binaries #5.
- Tom Lane identified an additional correctness concern: expression and ordinary-column positions must match between indexes, so he revised the comparison to reject mismatches explicitly before mapping ordinary columns #6.
- Tom Lane committed that patch unchanged on the development branch as 9f71e10d65 and backpatched the fix, including the separately supplied REL_12_STABLE candidate d6425987ba; the Valgrind harness was not included.
- After the commit, Michael Paquier questioned whether the new expression checks also required attribute mapping #7, and Tom explained that expression positions are compared directly while the map applies only to ordinary table columns #8.
- Michael then raised an example with swapped expression and column positions #9; Tom explained that those indexes must compare unequal and that the fix enforces the existing documented intent, leaving the committed fix intact with no further patch proposed by the thread's end #10.