pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bruce Momjian <bruce@momjian.us>
Cc: Bryn Llewellyn <bryn@yugabyte.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Isaac Morland <isaac.morland@gmail.com>
Cc: John W Higgins <wishdev@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Have I found an interval arithmetic bug?
Date: Mon, 12 Apr 2021 19:38:21 -0400
Message-ID: <3135041.1618270701@sss.pgh.pa.us> (raw)
In-Reply-To: <20210412232237.GA4231@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>
	<CALNJ-vR9s8zjGkUrxqLbK5GMS8Rn-o=dxb56gNSaWCHUKQZAvQ@mail.gmail.com>
	<CALNJ-vQE-W9K8b_XicbeR6CEkzUsA=CqarkwTLjudYTBpH90uw@mail.gmail.com>
	<CALNJ-vQkNfeM--i_L9XSpXsP_sj=UYFnAtF+u2ZhGUSe0PW6Cw@mail.gmail.com>
	<20210412161842.GA22319@momjian.us>
	<8707105F-C45D-4ACB-8F71-51CE5BED58A5@yugabyte.com>
	<20210412232237.GA4231@momjian.us>

Bruce Momjian <bruce@momjian.us> writes:
> On Mon, Apr 12, 2021 at 03:09:48PM -0700, Bryn Llewellyn wrote:
>> After all, you've bitten the bullet now and changed the behavior. This means that the semantics of some extant applications will change. So... in for a penny, in for a pound?

> The docs now say:

>      Field values can have fractional parts;  for example, <literal>'1.5
>      weeks'</literal> or <literal>'01:02:03.45'</literal>.  The fractional
> -->  parts are used to compute appropriate values for the next lower-order
>      internal fields (months, days, seconds).

> meaning fractional years flows to the next lower internal unit, months,
> and no further.  Fractional months would flow to days.  The idea of not
> flowing past the next lower-order internal field is that the
> approximations between units are not precise enough to flow accurately.

Um, what's the argument for down-converting AT ALL?  The problem is
precisely that any such conversion is mostly fictional.

> With my patch, the output is now:

> 	SELECT INTERVAL '3 years 10.241604 months';
> 	        interval
> 	------------------------
> 	 3 years 10 mons 7 days

> It used to flow to seconds.

Yeah, that's better than before, but I don't see any principled argument
for it not to be "3 years 10 months", full stop.

			regards, tom lane





view thread (99+ messages)  latest in thread

Message-ID: <3135041.1618270701@sss.pgh.pa.us>
Permalink:  ../3135041.1618270701@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3135041.1618270701@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bruce@momjian.us, bryn@yugabyte.com, zyu@yugabyte.com, pryzby@telsasoft.com, isaac.morland@gmail.com, wishdev@gmail.com
  Subject: Re: Have I found an interval arithmetic bug?
  In-Reply-To: <3135041.1618270701@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox