From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0A74F2B804 for ; 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 ; 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 ; Thu, 27 Sep 2018 16:24:12 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 6/6] sql: discard numeric conversion by unary plus References: From: Vladislav Shpilevoy 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: 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: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org, Nikita Pettik 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 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(-) >