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

From: Julien Rouhaud <rjuju123(at)gmail(dot)com>
To: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
Cc: 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 07:46:11
Message-ID: 20220315074611.xe3x25pjv3e2clmt@jrouhaud
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Mar 15, 2022 at 12:54:58PM +0530, Prabhat Sahu wrote:
>
> Kindly check the below scenario with INTERVAL datatype.
>
> postgres=# select interval '01 20:59:59' + interval '00 05:00:01' as
> interval;
> interval
> ----------------
> 1 day 26:00:00
> (1 row)
>
> Any operation with INTERVAL data, We are changing the interval values as
> "60 sec" as "next minute"
> "60 min" as "next hour"
> *Similarly can't we consider "24 Hours" for "next day" ?*
> 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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-03-15 08:23:40 Re: Add checkpoint and redo LSN to LogCheckpointEnd log message
Previous Message Julien Rouhaud 2022-03-15 07:41:03 Re: ICU for global collation