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 DF08B2C800 for ; Thu, 25 Apr 2019 07:21:38 -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 zQ82P2Uu-I8i for ; Thu, 25 Apr 2019 07:21:38 -0400 (EDT) Received: from smtp18.mail.ru (smtp18.mail.ru [94.100.176.155]) (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 7BD122B8D5 for ; Thu, 25 Apr 2019 07:21:36 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: invalid integer type in arithmetic operations References: <72941eba60647c98f4559cbd0c862bade990d761.1556120090.git.kshcherbatov@tarantool.org> <0929e575-2d28-7cd0-36bc-0a1bf1af76fe@tarantool.org> <04E0C86F-84E5-400F-ACE0-80FD6799E4E3@tarantool.org> <20190425104956.GI29257@atlas> <20190425105237.GA2297@atlas> <20190425111556.GL29257@atlas> From: Kirill Shcherbatov Message-ID: <9fdb5c0e-eb00-cdd1-eaac-179e58f64907@tarantool.org> Date: Thu, 25 Apr 2019 14:21:34 +0300 MIME-Version: 1.0 In-Reply-To: <20190425111556.GL29257@atlas> Content-Type: text/plain; charset=utf-8 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, Konstantin Osipov Cc: Vladislav Shpilevoy > Please do a table. You already have a branching hell, and UNSIGNED > arithmetics is raising questions. In particular, > I disagree that unsigned + unsigned should give you number - it should give you unsigned. It is not so, look (master, ff8462554d33d971e6d6df3c6e8913785e7d9d61): - if (sql_type_is_numeric(lhs) || sql_type_is_numeric(rhs)) - return FIELD_TYPE_NUMBER; + if (sql_type_is_numeric(lhs) || sql_type_is_numeric(rhs)) { + if (lhs == FIELD_TYPE_NUMBER || rhs == FIELD_TYPE_NUMBER) + return FIELD_TYPE_NUMBER; + if (lhs == FIELD_TYPE_INTEGER || rhs == FIELD_TYPE_INTEGER) + return FIELD_TYPE_INTEGER; + assert(lhs == FIELD_TYPE_UNSIGNED || + rhs == FIELD_TYPE_UNSIGNED); + return FIELD_TYPE_UNSIGNED; + }