pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: Bryn Llewellyn <bryn@yugabyte.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Isaac Morland <isaac.morland@gmail.com>
Cc: John W Higgins <wishdev@gmail.com>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Subject: Re: Have I found an interval arithmetic bug?
Date: Thu, 8 Apr 2021 13:24:44 -0400
Message-ID: <20210408172444.GC6909@momjian.us> (raw)
In-Reply-To: <20210405180158.GB12179@momjian.us>
References: <E34DA978-0C0E-4F43-97CD-278FA0C228E5@yugabyte.com>
	<20210403022126.GG29126@momjian.us>
	<20210405163310.GP6592@telsasoft.com>
	<20210405180158.GB12179@momjian.us>

On Mon, Apr  5, 2021 at 02:01:58PM -0400, Bruce Momjian wrote:
> On Mon, Apr  5, 2021 at 11:33:10AM -0500, Justin Pryzby wrote:
> Well, bug or not, we are not going to change back branches for this, and
> if you want a larger discussion, it will have to wait for PG 15.
> 
> > > https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-INTERVAL-INPUT
> > > « …field values can have fractional parts; for example '1.5 week' or '01:02:03.45'. Such input is converted to the appropriate number of months, days, and seconds for storage. When this would result in a fractional number of months or days, the fraction is added to the lower-order fields using the conversion factors 1 month = 30 days and 1 day = 24 hours. For example, '1.5 month' becomes 1 month and 15 days. Only seconds will ever be shown as fractional on output. »
> 
> I see that.  What is not clear here is how far we flow down.  I was
> looking at adding documentation or regression tests for that, but was
> unsure.  I adjusted the docs slightly in the attached patch.

Here is an updated patch, which will be for PG 15.  It updates the
documentation to state:

	The fractional parts are used to compute appropriate values for the next
	lower-order internal fields (months, days, seconds).

It removes the flow from fractional months/weeks to
hours-minutes-seconds, and adds missing rounding for fractional
computations.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  If only the physical world exists, free will is an illusion.

Attachments:

  interval.diff (text/x-diff, 0B) download

view thread (95+ messages)  latest in thread

Message-ID: <20210408172444.GC6909@momjian.us>
Permalink:  ../20210408172444.GC6909@momjian.us/
Also on:    postgresql.org/message-id/20210408172444.GC6909@momjian.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: bruce@momjian.us, pryzby@telsasoft.com, bryn@yugabyte.com, zyu@yugabyte.com, isaac.morland@gmail.com, wishdev@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Have I found an interval arithmetic bug?
  In-Reply-To: <20210408172444.GC6909@momjian.us>
  References: <E34DA978-0C0E-4F43-97CD-278FA0C228E5@yugabyte.com> <20210403022126.GG29126@momjian.us> <20210405163310.GP6592@telsasoft.com> <20210405180158.GB12179@momjian.us> <20210408172444.GC6909@momjian.us>

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

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