Re: Remove dependence on integer wrapping

Поиск
Список
Период
Сортировка
От Joseph Koshakow
Тема Re: Remove dependence on integer wrapping
Дата
Msg-id CAAvxfHeg0En5VV_9pjoHgd0kerK7REL84XEiS6=PUDOSKwx9rg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Remove dependence on integer wrapping  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: Remove dependence on integer wrapping
Список pgsql-hackers
On Mon, Jul 22, 2024 at 6:27 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> Actually, I think my concerns about prohibiting more than necessary go away
> if we do the subtraction first.  If "upperIndx[i] - lowerIndx[i]"
> overflows, we know the array size is too big.  Similarly, if adding one to
> that result overflows, we again know the the array size is too big.  This
> appears to be how the surrounding code handles this problem (e.g.,
> ReadArrayDimensions()).  Thoughts?

I like that approach! It won't reject any valid bounds and is
consistent with the surrounding code. Also statements of the following
format will maintain the same error messages they had previously:

    # INSERT INTO arroverflowtest(i[2147483646:2147483647]) VALUES ('{1,2}');
    ERROR:  array lower bound is too large: 2147483646

The specific bug that this patch fixes is preventing the following
statement:

    # INSERT INTO arroverflowtest(i[-2147483648:2147483647]) VALUES ('{1}');

So we may want to add that test back in.

Thanks,
Joseph Koshakow

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PATCH] GROUP BY ALL
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_upgrade and logical replication