model-writtenrun 8874 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Dec 2019 - Jan 2020 ยท 14 entries
- Vik Fearing proposed gcd() for smallint, integer and bigint using the Euclidean algorithm after discovering that PostgreSQL lacked the LCM operation he needed #1.
- Fabien COELHO questioned zero and minimum-integer behavior, requested stronger tests and suggested swapping arguments before division; Vik added typed boundary tests and argument-order checks in #3, then swapping and comments in #5, following reviews in #2 and #4.
- Dean Rasheed demonstrated that the existing code could raise a floating-point exception for gcd(INT_MIN, -1), argued that unrepresentable positive results should raise overflow errors, and requested LCM alongside GCD because its overflow handling was worth providing centrally #8.
- The proposal prompted debate about scope and namespace pollution: Merlin Moncure favored extensions, Peter Eisentraut questioned the use case, and Tom Lane and Robert Haas argued that existing mathematical functions made exclusion difficult to justify #11 #13 #14 #15 #17.
- Vik expanded the patch to include LCM and numeric implementations, rejected negative GCD results that represented overflow, and kept return types equal to argument types so callers could explicitly choose wider arithmetic #18.
- Chapman Flack and Alvaro Herrera suggested a separate schema for optional built-in functions, but Robert Haas identified implementation complexity and Tom Lane explained that changing schema precedence would not eliminate name-resolution hazards; the patch continued with ordinary built-in functions #20 #28 #31 #34.
- Fabien found that the initial swap compared signed values instead of magnitudes, while discussion of division costs reinforced keeping the optimization; Vik corrected the ordering with negative-space comparisons in #44 after #22, #37 and #38.
- Fabien challenged the restriction on negative LCM inputs, and Dean explained that Euclid's algorithm naturally supports fractional numerics and demonstrated potentially long-running numeric calculations; Vik allowed negative LCM and fractional GCD inputs and added interrupt checks in #52, following #48, #49, #50 and #51.
- Dean then explained fractional LCM as the least common integral multiple of decimal inputs, and Vik removed the remaining integrality restriction in the final attached patch #53 #55.
- Robert Haas opposed adding widespread branch-prediction hints, while Fabien defended them without patch-specific benchmark results; this discussion did not produce another attached revision #56 #57 #59.
- Dean proposed dropping the smallint overloads because automatic casts already covered their use, Tom supported that reasoning, and Vik accepted the removal when Dean took the patch for commitment #60 #61 #62 #63.
- Dean expanded the documentation to define both operations and their zero-input conventions; Vik refined the wording to 'integral multiple', and Alvaro suggested parentheses to distinguish mathematical definitions from implementation choices #64 #65 #66 #67 #68.
- Dean committed the integer, bigint and numeric portions of #55 as 13661ddd7e, omitting smallint overloads and making further corrections: the attempted INT_MIN/-1 guard had introduced an INT_MIN/+1 failure, and gcd_var() needed const-pointer arguments and safer temporary ownership #69.
- Vik acknowledged the fixes and thanked Dean for reviewing his first numeric implementation; the thread ended with the retained functionality committed and no outstanding patch revision #70.