[tarantool-patches] Re: [PATCH 6/6] sql: discard numeric conversion by unary plus

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Sep 27 23:24:10 MSK 2018


See 1 comment below.

On 17/09/2018 23:32, Nikita Pettik wrote:
> In SQLite unary plus behaves as implicit conversion to numeric type.
> Consider following example:
> 
> CREATE TABLE t1 (id INT PRIMARY KEY, a TEXT, b BLOB);
> INSERT INTO t1 VALUES (1, '99', '99');
> 
> SELECT * FROM t1 WHERE a = b; (*)
> SELECT * FROM t1 WHERE +a = +b; (**)
> 
> Since BLOB and TEXT are incompatible, result of (*) would be empty set.
> However, comparison in second query (**) would be of <NUMERIC> types,
> and result set would consist of one tuple [1, '99', '99'].
> 
> Lets discard this conversion produced by unary plus, since it implicitly
> affects result set of query and no one other DB support such behaviour.
> Instead, simply use type of operand it is related to.

So unary minus is ok?

> ---
>   src/box/sql/expr.c           |  9 ++++++
>   test/sql-tap/whereB.test.lua | 72 ++++++++++++++++++++++----------------------
>   2 files changed, 45 insertions(+), 36 deletions(-)
> 




More information about the Tarantool-patches mailing list