[Tarantool-patches] [PATCH v1 7/8] sql: rework SUBSTR() function

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Oct 9 01:02:14 MSK 2021


Thanks for the patch!

On 01.10.2021 18:29, Mergen Imeev via Tarantool-patches wrote:
> This patch makes SUBSTR() work according to ANSI rules for SUBSTRING()
> function. Also, SUBSTR() can now work correctly with large INTEGER
> values. The SUBSTR() syntax has not changed.

Does not make much sense given that Mem.n is just int. You can't
have strings or blobs larger than that.

> Part of #4145
> 
> @TarantoolBot document
> Title: SUBSTR() function
> 
> SUBSTR() now works according to the ANSI rules for SUBSTRING(), but with
> no syntax changes. What changed:
> 1) if the third argument is specified and it is less than 0, an error is
> thrown;
> 2) if the sum of the second and third arguments is less than 1, an empty
> string is returned;
> 3) if the second argument is less than 0, and the sum of the second and
> third arguments is greater than 1, then the result is equal to the
> result of SUBSTR() with the second argument equal to 1 and the third
> argument equal to the sum of the original second and third arguments
> minus 1.

I don't understand how it works now. What are the arguments? What
do they do? Can you explain fully? I see that a lot of tests now has
turned into errors and I don't understand why did they stop working.

In the code I couldn't find any comments.


More information about the Tarantool-patches mailing list