Re: value returned by EXTRACT, date_part

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Lumby <johnlumby(at)hotmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: value returned by EXTRACT, date_part
Date: 2020-08-29 16:04:32
Message-ID: 3563362.1598717072@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

John Lumby <johnlumby(at)hotmail(dot)com> <DM6PR06MB55625C1A9319BC921F4FB4ACA3530(at)DM6PR06MB5562(dot)namprd06(dot)prod(dot)outlook(dot)com> writes:
> What is not clear to me is how the "components" (aka "subfields") of an
> interval are defined.

The spec says that year,month,day,hour,minute,second are independent
fields. Postgres doesn't implement it quite that way: we treat the
basic fields as being months, days, and (micro)seconds, folding the
other values into those for storage. That's why "14 months" comes out
as "1 year 2 months", for example.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christophe Pettus 2020-09-03 02:58:05 Re: Crossing/Rotating table rows to rows and columns
Previous Message John Lumby 2020-08-29 13:13:46 Re: value returned by EXTRACT, date_part