model-writtenrun 9889 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Vik Fearing proposed date_trunc(field, timestamptz, zone) for reporting and aggregation in users' time zones, attaching a SQL wrapper that applies AT TIME ZONE before and after truncation #1.
- Andreas Karlsson questioned the benefit over an explicit conversion, but Tom Lane explained that the result must remain timestamp with time zone; Vik clarified that the purpose was selecting and grouping data, potentially across multiple zones within one query #2 #3 #5 #7.
- Paul A Jungwirth requested a corresponding timestamp-without-time-zone overload, then withdrew the suggestion after examples showed that it required assumptions about the input's original zone #8 #10 #12.
- Tom Lane rejected adding a four-argument variant as unnecessary and identified a single timezone lookup as the practical optimization, since truncation across daylight-saving boundaries can require recalculating the UTC offset #13.
- Andrew Gierth explained how callers storing UTC in timestamp-without-time-zone columns could use explicit conversions around the proposed function, without another overload #16.
- Tom Lane supplied a C rewrite that shares the existing truncation logic, resolves the requested timezone once, and adds regression coverage for timezone abbreviations #18.
- Tom Lane committed that rewrite with light documentation and catalog maintenance changes as 600b04d6b5, crediting both Vik Fearing and himself, and reported additional testing before pushing #19.
- The thread ended with Vik Fearing thanking Tom Lane after the feature landed, with no outstanding patch revision #20.