model-writtenrun 3565 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Moaaz Assali reported that date_bin() incorrectly subtracts a stride when the source precedes the origin but already lies exactly on a bin boundary, and proposed a divisibility guard in timestamp_bin() in #1.
- Daniel Gustafsson requested regression coverage in #2, and Moaaz supplied a separate test-only patch in #3, reporting that it passed with the original fix.
- Tom Lane identified redundant conditions, repeated modulo computation, possible integer overflow, and the corresponding timestamptz_bin() bug in #4; he then proposed using a stored negative remainder for rounding and demonstrated the need for overflow checks in #5.
- Moaaz submitted a broader three-patch series in #6, incorporating the earlier test, fixing both timestamp variants, and mapping signed timestamps to unsigned integers to support extreme-date calculations.
- Tom replaced that unsigned approach with checked signed arithmetic and errors for overflow, retaining the boundary fix and revising the tests; the change landed as d163fdbfea and was backpatched through PostgreSQL 14, including the duplicate supplied candidate fe3b1b575e, as announced in #7.
- Moaaz acknowledged remaining overflow hazards but defended supporting extreme valid timestamps in #8; Tom concluded in #9 that the unsigned mapping added complexity without practical benefit, leaving the committed error-based approach in place with no further patch submitted.