Re: Fix overflow in justify_interval related functions

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: Fix overflow in justify_interval related functions
Дата
Msg-id 20220215005918.GA2186095@nathanxps13
обсуждение исходный текст
Ответ на Re: Fix overflow in justify_interval related functions  (Joseph Koshakow <koshy44@gmail.com>)
Ответы Re: Fix overflow in justify_interval related functions  (Joseph Koshakow <koshy44@gmail.com>)
Список pgsql-hackers
On Mon, Feb 14, 2022 at 04:57:07PM -0500, Joseph Koshakow wrote:
> On Mon, Feb 14, 2022 at 2:15 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
>> Makes sense.  So we could likely avoid it for justify_interval, but the
>> others are at the mercy of the interval implementation.
> 
> I'm not entirely sure what you mean by "it", but for both
> justify_interval and justify_days this commit throws an error if we
> try to set the months field above 2^31.
> 
>> +SELECT justify_days(interval '2147483647 months 30 days');
>> +ERROR:  interval out of range
>> +SELECT justify_interval(interval '2147483647 months 30 days');
>> +ERROR:  interval out of range
> 
> That's what these are testing.

I think it's possible to avoid overflow in justify_interval() in some cases
by pre-justifying the days.  I've attached a patch to demonstrate.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

Вложения

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: support for CREATE MODULE
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: Postgres 14.2 Windows can't rename temporary statistics file