Re: Fix for edge case in date_bin() function

Поиск
Список
Период
Сортировка
От Moaaz Assali
Тема Re: Fix for edge case in date_bin() function
Дата
Msg-id CALkF+nt9V0WW9i3ezbZ3OrSxrS5__mr62burPPL_4ZAYwrTU_g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fix for edge case in date_bin() function  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Fix for edge case in date_bin() function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello Tom,

Thanks for the quick patch!

You're right. The stride_usecs calculation, tm_delta += ustride_usecs, and final result calculations can overflow and need a guard.

However, I don't see the issue with the INT64 -> UINT64 mapping. The current implementation results in integer overflows (errors instead after the recent patch) even for valid timestamps where the result of date_bin() is also another valid timestamp. 

On the other hand, the INT64 -> UINT64 mapping solves this issue and allows the input of any valid source and origin timestamps as long as the stride chosen doesn't output invalid timestamps that cannot be represented by Timestamp(tz) type anyways. Since all INT64 values can be mapped 1-to-1 in UINT64, I don't see where the problem is.

Best regards,
Moaaz Assali

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: DOCS: Avoid using abbreviation "aka"
Следующее
От: Bertrand Drouvot
Дата:
Сообщение: Re: Synchronizing slots from primary to standby