Re: Can we consider "24 Hours" for "next day" in INTERVAL datatype ? - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Re: Can we consider "24 Hours" for "next day" in INTERVAL datatype ?
Date
Msg-id CAAvxfHeFRdMb9uV_UMfKAoPYNqSs6njK6gvRaT03CPCvG0ZEEg@mail.gmail.com
Whole thread Raw
In response to Re: Can we consider "24 Hours" for "next day" in INTERVAL datatype ?  (Julien Rouhaud <rjuju123@gmail.com>)
List pgsql-hackers
On Tue, Mar 15, 2022 at 3:46 AM Julien Rouhaud <rjuju123@gmail.com> wrote:
> On Tue, Mar 15, 2022 at 12:54:58PM +0530, Prabhat Sahu wrote:
> >
> > Is there any specific purpose we are holding the hours as an increasing
> > number beyond 24 hours also?
>
> Yes, you can't blindly assume that adding 24 hours will always be the same as
> adding a day.  You can just justify_days if you want to force that behavior.

The specific purpose by the way, at least according to the docs [1],
is daylights savings time:
> Internally interval values are stored as months, days, and microseconds. This is done because
> the number of days in a month varies, and a day can have 23 or 25 hours if a daylight savings
> time adjustment is involved.
Though I suppose leap seconds may also follow similar logic.

[1] https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT

- Joe Koshakow



pgsql-hackers by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: Assert in pageinspect with NULL pages
Next
From: Julien Rouhaud
Date:
Subject: Re: Change the csv log to 'key:value' to facilitate the user to understanding and processing of logs