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

From: Prabhat Sahu <prabhat(dot)sahu(at)enterprisedb(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Can we consider "24 Hours" for "next day" in INTERVAL datatype ?
Date: 2022-03-15 07:24:58
Message-ID: CANEvxPp6p3PCaDnj5kjJ0A9DbY=w79V49wb27_JTnGLEp0DFrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi All,
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?

But when we are dealing with TIMESTAMP with INTERVAL values it's considered
the "24 Hours" for "next day".

postgres=# select timestamp '01-MAR-22 20:59:59' + interval '00 05:00:01'
as interval;
interval
---------------------
2022-03-02 02:00:00
(1 row)

--

With Regards,
Prabhat Kumar Sahu
EnterpriseDB: http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2022-03-15 07:25:45 Re: BufferAlloc: don't take two simultaneous locks
Previous Message Bharath Rupireddy 2022-03-15 06:49:47 Re: Add checkpoint and redo LSN to LogCheckpointEnd log message