Re: Decade indication

From: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Decade indication
Date: 2020-01-20 23:11:18
Message-ID: CAMsGm5cSWUuFZ+we-9DPaq91XLZ27rZkxgkEBxmsPSHw+U3ApA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 17 Jan 2020 at 17:52, Bruce Momjian <bruce(at)momjian(dot)us> wrote:

> I assume there is enough agreement that decades start on 20X0 that we
> don't need to document that Postgres does that.
>

I think the inconsistency between years, decades, centuries, and millenia
is worthy of documentation. In fact, it already is for EXTRACT:

https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT

It describes decade as "The year field divided by 10", whereas for century
and millennium it refers to centuries and millennia beginning in '01 years.
I think if I were designing EXTRACT I would probably have decades follow
the pattern of century and millennium, mostly because if somebody wants
year / 10 they can just write that. But I am, to say the least, not
proposing any modifications to this particular API, for multiple reasons
which I'm sure almost any reader of this list will agree with.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-01-21 00:35:17 Re: PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node
Previous Message Egor Rogov 2020-01-20 23:07:17 Re: BRIN cost estimate breaks geometric indexes