From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Jerry Sievert <jerry(at)legitimatesounding(dot)com> |
Cc: | rafiss(at)gmail(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
Subject: | Re: BUG #16804: substring() function returns "negative substring length" error when using a large length argument |
Date: | 2021-01-04 19:30:59 |
Message-ID: | CAFj8pRCuBWsi=Hf3pmbN8kJHu+y+O8-Hn+XEp_R7Yn3TOQBj0A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
po 4. 1. 2021 v 20:25 odesílatel Jerry Sievert <jerry(at)legitimatesounding(dot)com>
napsal:
> Hi,
>
> On Jan 4, 2021, at 11:21 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
>
>
>
> po 4. 1. 2021 v 19:44 odesílatel PG Bug reporting form <
> noreply(at)postgresql(dot)org> napsal:
>
>> > select substring('string' from 2 for 2147483646);
>>
>> Actual result:
>>
>> 2021-01-04 12:43:13.145 EST [85734] ERROR: negative substring length not
>> allowed
>> 2021-01-04 12:43:13.145 EST [85734] STATEMENT:s
>> negative substring length not allowed
>>
>> Minimally this is a bug and it should raise an error "integer out of
> range". Probably in this case we can use MAX_INT as a special value of
> unlimited length, although it is a little bit scary, because length is an
> optional value. The attached patch should fix this issue. I do not have
> access to Oracle to check the behaviour of this case there.
>
>
> Except according to the pg docs, it’s not out of range, it’s one less than
> MAX_INT.
>
> The manual calls for it to be an integer, which is defined as:
>
> integer 4 bytes typical choice for integer -2147483648 to +2147483647
>
> The original bug report is one less than +2147483647, and thus should be a
> valid value, no?
>
yes, so the implementation patch is really correct.
Regards
Pavel
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-01-04 21:28:01 | Re: BUG #16804: substring() function returns "negative substring length" error when using a large length argument |
Previous Message | Jerry Sievert | 2021-01-04 19:25:16 | Re: BUG #16804: substring() function returns "negative substring length" error when using a large length argument |