From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <tarantool-patches-bounce@freelists.org>
Received: from localhost (localhost [127.0.0.1])
	by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0A74F2B804
	for <tarantool-patches@freelists.org>; Thu, 27 Sep 2018 16:24:13 -0400 (EDT)
Received: from turing.freelists.org ([127.0.0.1])
	by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id C0-CNO74IHG5 for <tarantool-patches@freelists.org>;
	Thu, 27 Sep 2018 16:24:12 -0400 (EDT)
Received: from smtp55.i.mail.ru (smtp55.i.mail.ru [217.69.128.35])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id BD0492B4B2
	for <tarantool-patches@freelists.org>; Thu, 27 Sep 2018 16:24:12 -0400 (EDT)
Subject: [tarantool-patches] Re: [PATCH 6/6] sql: discard numeric conversion
 by unary plus
References: <cover.1537216077.git.korablev@tarantool.org>
 <a195fd1d462ad0d68d84dba0ab093d0119610bbe.1537216078.git.korablev@tarantool.org>
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Message-ID: <050a58c0-759e-28d2-5389-e7bad74826f6@tarantool.org>
Date: Thu, 27 Sep 2018 23:24:10 +0300
MIME-Version: 1.0
In-Reply-To: <a195fd1d462ad0d68d84dba0ab093d0119610bbe.1537216078.git.korablev@tarantool.org>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Sender: tarantool-patches-bounce@freelists.org
Errors-to: tarantool-patches-bounce@freelists.org
Reply-To: tarantool-patches@freelists.org
List-help: <mailto:ecartis@freelists.org?Subject=help>
List-unsubscribe: <tarantool-patches-request@freelists.org?Subject=unsubscribe>
List-software: Ecartis version 1.0.0
List-Id: tarantool-patches <tarantool-patches.freelists.org>
List-subscribe: <tarantool-patches-request@freelists.org?Subject=subscribe>
List-owner: <mailto:>
List-post: <mailto:tarantool-patches@freelists.org>
List-archive: <http://www.freelists.org/archives/tarantool-patches>
To: tarantool-patches@freelists.org, Nikita Pettik <korablev@tarantool.org>

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(-)
>