Re: Can we consider "24 Hours" for "next day" in INTERVAL datatype ?

From: Joseph Koshakow <koshy44(at)gmail(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Can we consider "24 Hours" for "next day" in INTERVAL datatype ?
Date: 2022-03-15 12:14:18
Message-ID: CAAvxfHeFRdMb9uV_UMfKAoPYNqSs6njK6gvRaT03CPCvG0ZEEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 15, 2022 at 3:46 AM Julien Rouhaud <rjuju123(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-03-15 12:38:34 Re: Change the csv log to 'key:value' to facilitate the user to understanding and processing of logs
Previous Message Justin Pryzby 2022-03-15 11:56:46 Re: Assert in pageinspect with NULL pages