model-writtenrun 6284 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- John Naylor proposed date_trunc_interval for binning time-series timestamps into arbitrary intervals, initially supporting timestamps without time zones and leaving conversion of existing date_trunc functions into wrappers outside the patch #1.
- David Fetter found that mixed year-and-millisecond intervals escaped validation and supplied a revised patch; John incorporated its bitmask approach, simplified it and corrected additional month/day boundary cases #2 #3.
- Tom Lane argued that binning needs an origin as well as a stride and identified problems with one-based fields, BC dates and error handling; John applied the arithmetic and validation corrections and then added an optional origin parameter #4 #6 #7.
- Isaac Morland showed that the origin-taking implementation misaligned weekly bins, while Arthur Zakirov demonstrated inconsistent fractional-year handling; John replaced calendar-field truncation with integer timestamp arithmetic for smaller units and separate month arithmetic, allowing compatible mixed units #8 #10 #11.
- Tels described chart aggregation with stable interval boundaries, and John confirmed that this was the intended use case, including arbitrary fortnight alignment #12 #13.
- John added four timestamptz variants with optional origin and explicit time zone, then revised origin alignment and future-origin behavior after Arthur reported surprising results; some time-zone tests and implementation details remained unresolved #14 #15 #16.
- After a three-month gap, John simplified month/year binning to require month-aligned origins, removed uncertain future-origin corrections, changed the default origin to 0001-01-01 and rebased the documentation #17.
- Peter Eisentraut questioned coupling the feature to date_trunc, supporting months and years, choosing an arbitrary default origin and retaining explicit time-zone variants; John proposed the name date_bin and agreed that reducing scope would simplify the feature #18 #19.
- John's next patch adopted date_bin, made origin mandatory, rejected month/year strides and removed explicit time-zone arguments because the origin could carry its time zone; negative strides remained permitted #20.
- Peter committed that simplified patch as 49ab61f0bd, restoring documentation, expanding tests and making small implementation corrections, then suggested named arguments as a possible follow-up #22.
- Erik Rijkers supplied documentation wording corrections, John refined the proposed wording and noticed duplicate semicolons, and Peter reported fixing those issues; named arguments received discussion but no attached implementation #23 #24 #25 #26 #27.
- Justin Pryzby identified the missing synopsis, and John supplied a documentation follow-up describing the arguments, bin-start return value and treatment of negative intervals #28 #30.
- John separately supplied a fix making future-origin inputs return the beginning of their bin, with AD and BC regression cases #29.
- When Salek Talangi mentioned TimescaleDB's time_bucket, John explained that the goal was a basic built-in facility available without installing an extension #31 #32.
- Peter committed the documentation follow-up from #30 as 49fb4e6b24, with light editorial changes #33.
- Peter questioned whether the future-origin fix needed its one-microsecond guard, accepted John's explanation that it preserved no-op behavior, and committed #29 unchanged as 496e58bb0e #33 #35 #36.
- Justin later noticed that the new synopsis incorrectly named date_trunc instead of date_bin and supplied an inline correction, which Peter reported fixing #37 #38.
- During PostgreSQL 14 beta testing, Bauyrzhan Sakhariyev demonstrated inconsistent negative-stride behavior for future origins and also reported a missing zero-stride check; John reported pushing the zero-stride fix with tests and revised error wording #39 #41 #42.
- John concluded that negative-stride semantics should be deferred during beta and posted a patch rejecting them; Tom Lane endorsed that choice, and Michael Paquier pointed out that the documentation still promised negative-stride support #43 #44 #45 #46.
- John committed #44 with the documentation corrected as 3ba70d4e15 and backpatched it to PostgreSQL 14, confirming completion in the thread's final message; the submitted feature and follow-up fixes had landed, while named arguments remained only a suggestion #47.