pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: John W Higgins <wishdev@gmail.com>
Cc: pgsql-hackers list <pgsql-hackers@lists.postgresql.org>
Subject: Re: Have I found an interval arithmetic bug?
Date: Fri, 30 Jul 2021 15:56:49 -0400
Message-ID: <20210730195649.GF9600@momjian.us> (raw)
In-Reply-To: <1119160.1627674882@sss.pgh.pa.us>
References: <CAPhAwGyccJZT-mXzHU1216Q-Z_xY3q+4TixzZ2sZf3hiPFe5tg@mail.gmail.com>
	<CAEZATCWaK0qdTiqxS=fM03VaKcfbYmSOV_JzqYDrVn2nSaMnFQ@mail.gmail.com>
	<20210728151916.GA15440@momjian.us>
	<20210730160439.GZ9600@momjian.us>
	<20210730160854.GA9600@momjian.us>
	<1008623.1627663774@sss.pgh.pa.us>
	<20210730190313.GC9600@momjian.us>
	<CA+TgmobqWU=eS1DGs-MomKJTwY9agfMF5NBN20tHBsyMWKuAmA@mail.gmail.com>
	<20210730192010.GD9600@momjian.us>
	<1119160.1627674882@sss.pgh.pa.us>

On Fri, Jul 30, 2021 at 03:54:42PM -0400, Tom Lane wrote:
> Having said that, I also agree that it's not great that '1.4 years'
> is converted to '1 year 4 mons' (1.33333... years) rather than
> '1 year 5 mons' (1.41666... years).  The latter seems like a clearly
> saner translation.  I would really rather that we reject such input
> altogether, but if we're going to accept it, we should round not
> truncate.

My patch returns what you want:

	SELECT interval '1.4 years';
	   interval
	---------------
	 1 year 5 mons

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

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






view thread (99+ messages)  latest in thread

Message-ID: <20210730195649.GF9600@momjian.us>
Permalink:  ../20210730195649.GF9600@momjian.us/
Also on:    postgresql.org/message-id/20210730195649.GF9600@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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bruce@momjian.us, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, dean.a.rasheed@gmail.com, wishdev@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Have I found an interval arithmetic bug?
  In-Reply-To: <20210730195649.GF9600@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