Re: pgsql: Implement jsonpath .datetime() method

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема Re: pgsql: Implement jsonpath .datetime() method
Дата
Msg-id CAPpHfdvRPRh_mTGar5WmDeRZ=U5dOXHdxspYYD=76m3knNGjXA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pgsql: Implement jsonpath .datetime() method  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: pgsql: Implement jsonpath .datetime() method
Re: pgsql: Implement jsonpath .datetime() method
Список pgsql-committers
On Thu, Oct 3, 2019 at 4:48 PM Robert Haas <robertmhaas@gmail.com> wrote:
> On Tue, Oct 1, 2019 at 1:41 PM Alexander Korotkov
> <a.korotkov@postgrespro.ru> wrote:
> > So, basically standard requires us to suppress any error happening in
> > filter expression.
>
> Sounds like the standard is dumb, then. :-)
>
> > But as I wrote before suppression of errors in
> > datetime comparison may lead to surprising results.  That happens in
> > rare corner cases, but still.  This makes uneasy choice between
> > consistent behavior and standard behavior.
>
> Yeah.

Proposed patch eliminates this dilemma in particular case.  It
provides correct cross-type comparison of datetime values even if one
of values overflows during cast.  In order to do this, I made cast
functions to report whether lower or upper boundary is overflowed.  We
know that overflowed value is lower (or upper) than any valid value
except infinity.

This patch also changes the way timestamp to timestamptz cast works.
Previously it did timestamp2tm() then tm2timestamp().  Instead, after
timestamp2tm() it calculates timezone offset and applies it to
original timestamp value.  I hope this is correct.  If so, besides
making overflow handling easier, this refactoring saves some CPU
cycles.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Вложения

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Fix use of term "verifier"
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Implement jsonpath .datetime() method