pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: adrian.klaver@aklaver.com
Cc: frazer@frazermclean.co.uk
Cc: pgsql-general@postgresql.org
Subject: Re: Unexpected interval comparison
Date: Fri, 31 Mar 2017 13:29:24 -0400
Message-ID: <10353.1490981364@sss.pgh.pa.us> (raw)
In-Reply-To: <20170331.142157.204383147.horiguchi.kyotaro@lab.ntt.co.jp>
References: <375c9e5a-960f-942c-913f-55632a1f0a90@aklaver.com>
	<20170330.164651.249668658.horiguchi.kyotaro@lab.ntt.co.jp>
	<2087.1490885839@sss.pgh.pa.us>
	<20170331.142157.204383147.horiguchi.kyotaro@lab.ntt.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> At Thu, 30 Mar 2017 10:57:19 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote in <2087.1490885839@sss.pgh.pa.us>
>> A possible solution is to manually work in wider-than-64-bit
>> arithmetic, that is compute the comparison values div and mod
>> some pretty-large number and then compare the two halves.
>> I seem to recall that we did something similar in a few cases
>> years ago, before we were willing to assume that every machine
>> had 64-bit integer support.
>> 
>> Of course, for machines having int128, you could just use that
>> type directly.  I'm not sure how widespread that support is
>> nowadays.  Maybe a 95%-good-enough solution is to use int128
>> if available and otherwise throw errors for intervals exceeding
>> 64 bits.

> int128 is seen in numeric.c. It is doable in the same manner. In
> that case it will be a bit slower on the platforms without
> int128.

> By the way is it right that we don't assume this as a bug-fix
> which should be done in the Pg10 dev cycle, but an improvement
> for 11?

Well, it seems like a bug to me.  We might conclude that the fix
is too risky to back-patch, but it's hard to make that decision
before having a patch in hand to evaluate.

			regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (17+ messages)  latest in thread

Message-ID: <10353.1490981364@sss.pgh.pa.us>
Permalink:  ../10353.1490981364@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10353.1490981364@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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, horiguchi.kyotaro@lab.ntt.co.jp, adrian.klaver@aklaver.com, frazer@frazermclean.co.uk
  Subject: Re: Unexpected interval comparison
  In-Reply-To: <10353.1490981364@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