Re: Decade indication

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Decade indication
Date: 2019-12-31 21:53:17
Message-ID: 19170.1577829197@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com> writes:
> On Wed, Jan 1, 2020 at 3:05 AM Bruce Momjian <bruce(at)momjian(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2020-01-01 02:16:53 Re: backup manifests
Previous Message Andrew Dunstan 2019-12-31 21:34:59 Re: Decade indication