Andrew Dunstan <andrew.duns...@2ndquadrant.com> writes: > On Wed, Jan 1, 2020 at 3:05 AM Bruce Momjian <br...@momjian.us> wrote: >> Does the next decade start on 2020-01-01 or 2021-01-01? Postgres says >> it start on the former date: >> ... >> That seems inconsistent to me. /pgtop/src/backend/utils/adt/timestamp.c >> has this C comment: >> >> * what is a decade wrt dates? let us assume that decade 199 >> * is 1990 thru 1999... decade 0 starts on year 1 BC, and -1 >> * is 11 BC thru 2 BC...
> If I had to choose I'd go with the "general usage" rule above, but I > don't think we should change behaviour now. Well, yeah, that. The quoted comment dates to commit 46be0c18f of 2004-08-20, and a bit of excavation shows that it was just explaining behavior that existed before, clear back to when Lockhart installed all this functionality in 2001. It's pretty darn difficult to justify changing behavior that's stood for 18+ years, especially when the argument that it's wrong is subject to debate. Either users think it's correct, or nobody uses this function. In either case, nobody will thank us for changing it. It's possible that we could add an alternate keyword for a different decade (and/or century) definition, but I'd want to see some actual field demand for that first. regards, tom lane