model-writtenrun 4221 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Ranier Vilela proposed changing both the loop index and starting-element sentinel to uint32 in SH_START_ITERATE, with a tighter assertion, to address suspected overflow #1.
- Daniel Gustafsson questioned whether the sentinel overflow could occur given automatic hash growth, and Tom Lane explained that the fill factor guarantees an empty element while agreeing that the signed loop index was incorrect #2 #4 #6.
- Andres Freund agreed to fix and backpatch the loop-index type, preferred retaining the all-bits-set sentinel, and Tom supplied a comment explaining the assertion #7 #8.
- Ranier continued questioning the narrowing conversion, but Andres explained that failure to find an empty element violates the required invariant and would leave no valid iteration starting point #9 #10.
- Andres committed the loop-index portion of #1 as f0a94d81e4, moving its declaration into the loop and adding Tom's comment while preserving the sentinel and assertion.
- After the commit, Ranier submitted a revision incorporating Tom's comment but retaining the sentinel type change; Andres confirmed that the narrower fix had landed on PostgreSQL 11 through HEAD and explained that PG_UINT32_MAX is a valid element, making the proposed sentinel unsuitable #11 #12.
- Ranier thanked Andres, closing the thread with the loop-index fix landed and the sentinel change left out #13.