[Tarantool-patches] [PATCH v3 1/2] sql: fix CAST() from STRING to INTEGER

Nikita Pettik korablev at tarantool.org
Wed Mar 25 21:10:58 MSK 2020


On 25 Mar 14:38, imeevma at tarantool.org wrote:
> Prior to this patch, STRING, which contains the DOUBLE value,
> could be cast to INTEGER. This was done by converting STRING to
> DOUBLE and then converting this DOUBLE value to INTEGER. This may
> affect the accuracy of CAST(), so it was forbidden.
> 
> Before patch:
> tarantool> box.execute("SELECT CAST('1.1' as INTEGER);")
> ---
> - metadata:
>   - name: CAST('1.1' as INTEGER)
>     type: integer
>   rows:
>   - [1]
> ...
> 
> After patch:
> tarantool> box.execute("SELECT CAST('1.1' as INTEGER);")
> ---
> - null
> - 'Type mismatch: can not convert 1.1 to integer'
> ...

What about CAST('1.0' AS INTEGER)? Should this conversion be banned?
Moreover, your patch affects not only explicit cast. Please, split
it into two commits.

Doc. request is missing.



More information about the Tarantool-patches mailing list