[Tarantool-patches] [PATCH 1/6] sql: remove implicit cast for assignment

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Wed Jun 10 01:28:00 MSK 2020


Hi! Thanks for the patch!

>>> +    ]], {
>>> +        0
>>> +    })
>>> +
>>> diff --git a/test/sql-tap/numcast.test.lua b/test/sql-tap/numcast.test.lua
>>> index eeac5353a..9bbae5ca4 100755
>>> --- a/test/sql-tap/numcast.test.lua
>>> +++ b/test/sql-tap/numcast.test.lua
>>> @@ -135,7 +135,7 @@ test:do_catchsql_test(
>>>           INSERT INTO t VALUES(20000000000000000000.01);
>>>           SELECT * FROM t;
>>>       ]], {
>>> -        1,"Tuple field 1 type does not match one required by operation: expected integer"
>>> +        1,"Type mismatch: can not convert real to integer"
>> 8. Is it correct, that we can remove all the checks from OP_CheckType
>> except numeric conversions, and everything will work fine, because
>> box makes the type checks anyway? It seems OP_CheckType duplicates
>> box's work.
> This is correct in most cases. We will lose the implicit cast
> between numeric values, but this can be done, for example, during
> MakeRecord. In addition, all type mismatch errors will look the
> same as in Lua.

I didn't meant to remove number casts. Only non-numeric checks.
For example, if mem_check_type is called on a string, and target
is number, we can ignore that, and let box raise an error.

This should become even simpler, when MEM_<type> flags are
replaced with enum field_type.

Please, do it here, if it is easy, or file a new ticket (I mean
error fallthrough down to box, not MEM_<type> removal).


More information about the Tarantool-patches mailing list