model-writtenrun 4454 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Mats Kindahl reported that extreme float8 bounds could make width_bucket() return -2147483648 through overflowing intermediate arithmetic #1, then supplied a patch that halved inputs, divided before multiplying, and added overflow and underflow tests #2.
- Tom Lane warned that unconditional halving could cause underflow and proposed scaling only when the bounds' difference is infinite #3; Mats adopted that condition and explained why checking the operand difference separately was unnecessary #4.
- Tom committed the revised patch as b0e9e4d76c, also fixing descending bounds, making the final addition overflow-aware, and revising tests, as he explained in #5; the commit deliberately avoided back-patching because changing arithmetic order could alter bucket assignments near boundaries.
- Tom subsequently demonstrated that rounding could assign an in-range value to the end bucket in both float8 and numeric implementations, and proposed clamping the result #7.
- Tom implemented that follow-up in a2a0c7c29e, adding clamps and regression tests for both implementations and restoring localized overflow checks because clamped in-range results could safely be incremented.
- After the follow-up had already landed, Mats endorsed clamping and reported measurements showing little performance difference #8; this was post-commit feedback rather than pre-commit review.
- Tom closed the thread by confirming that the clamping change had already landed in a2a0c7c29e and apologizing for the delayed notification #9; both fixes were committed without backports.