Re: Unexpected interval comparison

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: adrian(dot)klaver(at)aklaver(dot)com, frazer(at)frazermclean(dot)co(dot)uk, pgsql-general(at)postgresql(dot)org
Subject: Re: Unexpected interval comparison
Date: 2017-04-05 21:06:53
Message-ID: 385.1491426413@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I wrote:
> Looking at what we've got here, it's already a substantial fraction of
> what would be needed to provide a compiler-independent implementation
> of the int128-based aggregate logic in numeric.c. With that in mind,
> I propose that we extract the relevant stuff into a new header file
> that is designed as general-purpose int128 support. Something like the
> attached. I also attach the test program I put together to verify it.

Here's a fleshed-out patch for the original problem based on that.
I found that direct int64-to-int128 coercions were also needed to
handle some of the steps in timestamp.c, so I added those to int128.h.

I think it would be reasonable to back-patch this, although it would
need some adjustments for the back branches since we only recently
got rid of the float-timestamp option. Also I'd not be inclined to
depend on native int128 any further back than it was already in use.

regards, tom lane

Attachment Content-Type Size
fix-overflow-during-interval-comparison-20170405-2.patch text/x-diff 18.5 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message George Neuner 2017-04-05 21:19:40 Re: browser interface to forums please?
Previous Message George Neuner 2017-04-05 20:31:50 Re: browser interface to forums please?