Re: Unexpected interval comparison

Поиск
Список
Период
Сортировка
От Kyotaro HORIGUCHI
Тема Re: Unexpected interval comparison
Дата
Msg-id 20170403.205118.123793330.horiguchi.kyotaro@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: Unexpected interval comparison  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Unexpected interval comparison  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hmm. It took a bit longer time than expected.

At Fri, 31 Mar 2017 13:29:24 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote in <10353.1490981364@sss.pgh.pa.us>
> Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> writes:
> > 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.

Ok, the attached patch changes the result type of
interval_cmp_value from TimeOffset(=int64) to new 128 bit
LinearInterval. The value is hidden under the functions
interval_eq/ge.../cmp and all other stuff seems to use the
functions.

For platforms without 128 bit support, int64 * 2 version of
interval_cmp_value is used.

I added separate test for the near-overflow values since just
adding such values into INTERVAL_TABLE resuted in a mess. (I ran
64-bit version by commenting-out the definition of PG_INT128_TYPE
in pg_config.h).

The attached patch is that.

regards,

--
Kyotaro Horiguchi
NTT Open Source Software Center

В списке pgsql-general по дате отправления:

Предыдущее
От: Steve Rogerson
Дата:
Сообщение: Oddity with time zones.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Oddity with time zones.