model-writtenrun 3838 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Hongxu Ma reported that selecting 200 million rows with 26 columns caused psql's cell-count multiplication to overflow #1; David G. Johnston initially interpreted the error as an intentional limit #2, but Hongxu explained why the check should not fail for a valid result and discussed widening the arithmetic #3.
- Hongxu submitted a long-based fix for printTableAddCell() #4, and Jelte Fennema-Nio endorsed it while requesting the clearer name total_cells #5, which Hongxu adopted #6.
- Michael Paquier pointed out that long is still 32 bits on Windows #7, while Tom Lane identified an earlier overflow in printTableInit() and questioned the practicality of such large results #8; Hongxu expanded the fix to initialization and cleanup #9, then switched the arithmetic and cellsadded field to int64 #10.
- After a two-month gap, Alvaro Herrera posted a lightly revised version credited to Hongxu and argued that machines with enough memory were realistic, rejecting a simple 32-bit overflow rejection as merely postponing the problem #11.
- Tom found that the widened cell count could still overflow the allocation size, proposed a SIZE_MAX guard and unsigned arithmetic, and said the rest passed inspection #12.
- Alvaro committed the latest attached patch #11 with uint64 arithmetic and the additional allocation guard as 24ea53dcfa, then announced the completed fix #13.
- After landing, Alvaro raised the possibility of recovering from printing errors instead of exiting #13; Tom approved the committed fix but noted API compatibility concerns #14, then suggested printing an error and returning normally as a possible compromise #16, leaving that separate improvement unimplemented.