Re: SUM() of INTERVAL type produces INTERVAL with no precision

From: Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SUM() of INTERVAL type produces INTERVAL with no precision
Date: 2021-12-03 16:45:58
Message-ID: DBAP191MB1289486D7BA190752083E59DB06A9@DBAP191MB1289.EURP191.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


My bad, sorry. RTFM Seb.
Seb
________________________________
From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Sent: Friday, December 3, 2021 5:30 PM
To: Sebastien Flaesch <sebastien(dot)flaesch(at)4js(dot)com>; Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SUM() of INTERVAL type produces INTERVAL with no precision

EXTERNAL: Do not click links or open attachments if you do not recognize the sender.

On 12/3/21 08:12, Sebastien Flaesch wrote:
>
> Hum....
>
> test1=> create table tab2 ( i interval hour to minute );
> CREATE TABLE
> test1=> insert into tab2 values ( interval '9999-10 555 11:22:33' );
> INSERT 0 1
> test1=> select * from tab2;
> i
> --------------------------------------
> 9999 years 10 mons 555 days 11:22:00
> (1 row)
>
> Expected?
>
> Qualifiers "hour to minute" seem just to be some decoration...

https://urldefense.com/v3/__https://www.postgresql.org/docs/current/datatype-datetime.html*DATATYPE-INTERVAL-INPUT__;Iw!!I_DbfM1H!RExSz7qwDTY70m7inqoIFBso3O-e15X0Aza2CJ7tHhCV27fI70fJtnuDTTLb7EIGJcpI$

"... Also, field values “to the right” of the least significant field
allowed by the fields specification are silently discarded. For example,
writing INTERVAL '1 day 2:03:04' HOUR TO MINUTE results in dropping the
seconds field, but not the day field."

>
> Seb
> ------------------------------------------------------------------------

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-12-03 17:14:21 Re: libpq: Which functions may hang due to network issues?
Previous Message Dmitry Dolgov 2021-12-03 16:31:08 Re: Max connections reached without max connections reached