agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Lumby <johnlumby@hotmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-sql <pgsql-sql@lists.postgresql.org>
Subject: Re: value returned by EXTRACT, date_part
Date: Sat, 29 Aug 2020 12:04:32 -0400
Message-ID: <3563362.1598717072@sss.pgh.pa.us> (raw)
In-Reply-To: <DM6PR06MB55625C1A9319BC921F4FB4ACA3530@DM6PR06MB5562.namprd06.prod.outlook.com>
References: <DM6PR06MB5562115198C798B1C06B32DBA3520@DM6PR06MB5562.namprd06.prod.outlook.com>
	<CAKFQuwZBu3Hp__XKSWeBeqyep=UVd9-4x9nnLvfxxAW3hgCJfg@mail.gmail.com>
	<DM6PR06MB5562A231945B39D33623849BA3520@DM6PR06MB5562.namprd06.prod.outlook.com>
	<3517945.1598665173@sss.pgh.pa.us>
	<DM6PR06MB55625C1A9319BC921F4FB4ACA3530@DM6PR06MB5562.namprd06.prod.outlook.com>

John Lumby <johnlumby@hotmail.com> <DM6PR06MB55625C1A9319BC921F4FB4ACA3530@DM6PR06MB5562.namprd06.prod.outlook.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





view thread (6+ messages)

Message-ID: <3563362.1598717072@sss.pgh.pa.us>
Permalink:  ../3563362.1598717072@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3563362.1598717072@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, johnlumby@hotmail.com, david.g.johnston@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: value returned by EXTRACT, date_part
  In-Reply-To: <3563362.1598717072@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox