Re: BUG #18445: date_part / extract range for hours do not match documentation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marek Läll <lall(dot)marek(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "fcaldasdesou(at)bloomberg(dot)net" <fcaldasdesou(at)bloomberg(dot)net>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18445: date_part / extract range for hours do not match documentation
Date: 2024-04-26 20:19:36
Message-ID: 24615.1714162776@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

=?UTF-8?Q?Marek_L=C3=A4ll?= <lall(dot)marek(at)gmail(dot)com> writes:
>> We tend not to introduce breaking changes if the only motivation is to be
>> consistent.

> Other mistakes are minor, but why is time '24:00:00' allowed, and it's
> actually 00:00:00 of the next day, that's something I'd like to read a
> well-argued design decision.

[ shrug... ] You're about twenty-five years too late to argue about
this.

The SQL spec does say that the HOUR field of a time value should be
0-23, so allowing '24:00:00' is an extension, most likely decided by
Thomas Lockhart who wrote most of PG's datetime code to begin with.
He's long gone from the project and probably doesn't remember his
exact reasoning anyway. But we're not likely to remove that extension
now, because there might be applications out there depending on it,
and it's quite unclear what it's hurting. Arguing from principles
of consistency when discussing common timekeeping rules is pointless
anyway --- what in the world is consistent about any of it?

It could be that Thomas deemed this a more sensible representation
of '23:59:60', an input that's explicitly allowed by the SQL spec.
But that's just guessing.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Melanie Plageman 2024-04-26 20:46:08 Re: relfrozenxid may disagree with row XIDs after 1ccc1e05ae
Previous Message David G. Johnston 2024-04-26 19:36:30 Re: BUG #18445: date_part / extract range for hours do not match documentation