Re: Remove dependence on integer wrapping

Поиск
Список
Период
Сортировка
От Joseph Koshakow
Тема Re: Remove dependence on integer wrapping
Дата
Msg-id CAAvxfHfeUmVMXU6883in2H-jJ+Vn2=mcSgVpsNDRTTK=OYDjoA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Remove dependence on integer wrapping  (jian he <jian.universality@gmail.com>)
Ответы Re: Remove dependence on integer wrapping
Список pgsql-hackers


On Wed, Jul 17, 2024 at 9:31 PM jian he <jian.universality@gmail.com> wrote:
>
> i think "INSERT INTO arroverflowtest(i[2147483647:2147483647]) VALUES ('{}');"
> means to insert one element (size) to a customized lower/upper bounds.

Ah, thank you, I mistakenly understood that as an array with size
2147483647, with the first 2147483646 elements NULL.

I've updated the first calculation (upper_bound + 1) to retrun an error
saying "array upper bound is too large: %d" when it overflows. This
will change some of the existing error messages, but is just as correct
and doesn't require us to check the source array. Is there backwards
compatibility guarantees on error messages or is that acceptable?


For the second calculation ((upper_bound + 1) - lower_bound), I've kept the
existing error of "array size exceeds the maximum allowed (%d)". The
only way for that to underflow is if the upper bound is very negative
and the lower bound is very positive. I'm not entirely sure how to
interpret this scenario, but it's consistent with similar scenarios.

    # INSERT INTO arroverflowtest(i[10:-999999]) VALUES ('{1,2,3}');
    ERROR:  array size exceeds the maximum allowed (134217727)

As a reminder:
- 0001 is reviewed.
- 0002 is reviewed and a bug fix.
- 0003 is currently under review and a bug fix.
- 0004 needs a review.

Thanks,
Joe Koshakow
Вложения

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

Предыдущее
От: 김명준
Дата:
Сообщение: Re: [ pg_ctl ] Review Request for Adding Pre-check User Script Feature
Следующее
От: torikoshia
Дата:
Сообщение: Re: Add on_error and log_verbosity options to file_fdw