[Tarantool-patches] [PATCH v2 3/7] sql: replace ApplyType by CheckType for IN operator

Nikita Pettik korablev at tarantool.org
Mon Jun 22 12:32:37 MSK 2020


On 17 Jun 15:36, imeevma at tarantool.org wrote:
> This patch removes implicit cast from STRING to numeric
> and vice versa of left operand of IN operator.
> 
> Part of #4230
> Part of #4692
> ---
>  src/box/sql/expr.c                   |  2 +-
>  test/sql-tap/in3.test.lua            | 14 +-----
>  test/sql-tap/subquery.test.lua       | 69 +---------------------------
>  test/sql-tap/tkt-80e031a00f.test.lua |  4 +-
>  test/sql/boolean.result              | 12 ++---
>  5 files changed, 11 insertions(+), 90 deletions(-)
> 
> diff --git a/test/sql-tap/tkt-80e031a00f.test.lua b/test/sql-tap/tkt-80e031a00f.test.lua
> index a0e6539e0..c883937ca 100755
> --- a/test/sql-tap/tkt-80e031a00f.test.lua
> +++ b/test/sql-tap/tkt-80e031a00f.test.lua
> @@ -346,7 +346,7 @@ test:do_catchsql_test(
>          SELECT 'hello' IN t1
>      ]], {
>          -- <tkt-80e031a00f.27>
> -        1, 'Type mismatch: can not convert hello to integer'
> +        1, 'Type mismatch: can not convert text to integer'
>          -- </tkt-80e031a00f.27>
>      })
>  
> @@ -356,7 +356,7 @@ test:do_catchsql_test(
>          SELECT 'hello' NOT IN t1
>      ]], {
>          -- <tkt-80e031a00f.28>
> -        1, 'Type mismatch: can not convert hello to integer'
> +        1, 'Type mismatch: can not convert text to integer'
>          -- </tkt-80e031a00f.28>
>      })

Again, old format of error message containing value which
can't be converted seems more suitable to me. Mb it is worth
combining them putting in error message both type and value:

... convert 'hello' (type : text) to integer
 
Otherwise LGTM

> diff --git a/test/sql/boolean.result b/test/sql/boolean.result
> index e88183854..c74713c34 100644
> --- a/test/sql/boolean.result
> +++ b/test/sql/boolean.result
> @@ -3877,12 +3877,12 @@ SELECT false IN (0, 1, 2, 3);
>  SELECT true IN (SELECT b FROM t7);
>   | ---
>   | - null
> - | - 'Type mismatch: can not convert TRUE to integer'
> + | - 'Type mismatch: can not convert boolean to integer'
>   | ...


More information about the Tarantool-patches mailing list