From: | Vladimir Svedov <vodevsh(at)gmail(dot)com> |
---|---|
To: | bruce(at)momjian(dot)us |
Cc: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Subject: | Re: DATE_PART('field', INTERVAL) not intuitive literal reading of interval |
Date: | 2018-06-20 12:42:54 |
Message-ID: | CADqDLE8BiJyDNxNeHVsZN3PYRp1hGL6OECYK6BZboJJE0JxzPA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
On Wed, 20 Jun 2018 at 15:12, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> On Tue, Jun 19, 2018 at 11:58:39PM -0400, Bruce Momjian wrote:
> > On Tue, May 22, 2018 at 10:55:14AM +0000, PG Doc comments form wrote:
> > >
> https://stackoverflow.com/questions/50465632/postgresql-10-4-date-difference/50465676#50465676
> >
> > This is really a function of how interval computes months, days, and
> > seconds from subtraction, which is outlined here:
> >
> >
> https://www.postgresql.org/docs/10/static/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
> >
> > I don't think adding something to the functions-datetime.html section
> > makes sense. For example, this returns 1:
> >
> > SELECT extract(minutes from '1 hour 1 minute'::interval);
> > date_part
> > -----------
> > 1
>
> Thinking some more, I wonder if this behavior should be more clearly
> documented:
>
> SELECT EXTRACT(hours from '80 minutes'::interval);
> date_part
> -----------
> 1
>
> SELECT EXTRACT(days from '80 hours'::interval);
> date_part
> -----------
> 0
>
> To me, this clearly shows the behavior of the months, days, and seconds
> components. I have developed the attached doc patch to mention this.
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + As you are, so once was I. As I am, so you will be. +
> + Ancient Roman grave inscription +
>
Yes, it covers my question great. Thank you
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2018-06-20 14:04:24 | Re: Misc typos in documentation |
Previous Message | Bruce Momjian | 2018-06-20 12:12:17 | Re: DATE_PART('field', INTERVAL) not intuitive literal reading of interval |