From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 7B2E56EC55; Sat, 9 Oct 2021 01:02:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7B2E56EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633730568; bh=euWdTLQP/7a3jf27rIMvjHHVJiSnbwLPVuOYnVgV46o=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=kgDLLW4o8BqgbQWEIyLlSmEVqYKotDRsPgBdFNDWIbTzt4QaS/wjRGh2ZvtQHvqeg NKwgZkaqB9ENaP1dmTVrYjfw79E67m9+DorndXSTKK9lRJFNXhZQSQ1s1d8O4H2gAy /sg936YOddOuq5aidKcvqV+FvEp5+JCwe6EUr3Hg= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D32156EC55 for ; Sat, 9 Oct 2021 01:02:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D32156EC55 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mYxwq-0006jQ-5E; Sat, 09 Oct 2021 01:02:36 +0300 Message-ID: <762d321c-004d-4ef9-7d8c-1314c19fc673@tarantool.org> Date: Sat, 9 Oct 2021 00:02:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <873f9256f524e841ae7489ca21933ce16a9a34e0.1633105483.git.imeevma@gmail.com> Content-Language: en-US In-Reply-To: <873f9256f524e841ae7489ca21933ce16a9a34e0.1633105483.git.imeevma@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9A6D4E3B1981C4C7DC9765195527EE77661ADD44F6E79FA5A182A05F53808504084BEA0D922B507455ADBA3922181B7BF3B2DAD6DDE8A42272D1141B89F1B3E1B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7CA8E915ACC910FBDEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637160171C9EBC7AFE48638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8649E40BF4D57515CBDEB62B88AE9CA4A117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BAA867293B0326636D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6B1CFA6D474D4A6A4089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505178C323EEE45813BE7C5F5245ED204B5 X-C1DE0DAB: 0D63561A33F958A59C96EE8BD90E229019770178483E853FBCDDEB1618B52DB0D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AC6E62257D6CD1C9438EE3E50CA1D3634C7FC8501EF8BA86BC0845EC0955BD19A5D7346EAA5BB89A1D7E09C32AA3244C4C1268FD5B8742B38A94C2ED6A3D53EBF522A1CF68F4BE05729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojMZ06aokA6bocVGpY0N627w== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DCB742BC367206D8E60197CFD1368D6B63841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 8/8] sql: refactor LIKE() function X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thanks for the patch! > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index 1b4d52225..27106ced6 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -1281,46 +1281,28 @@ likeFunc(sql_context *context, int argc, struct Mem *argv) > { > u32 escape = SQL_END_OF_STRING; > int nPat; > - if (argc != 2 && argc != 3) { > - diag_set(ClientError, ER_FUNC_WRONG_ARG_COUNT, > - "LIKE", "2 or 3", argc); > - context->is_aborted = true; > - return; > - } > - sql *db = sql_context_db_handle(context); > - int rhs_type = sql_value_type(&argv[0]); > - int lhs_type = sql_value_type(&argv[1]); > - > - if (lhs_type != MP_STR || rhs_type != MP_STR) { > - if (lhs_type == MP_NIL || rhs_type == MP_NIL) > - return; > - const char *str = rhs_type != MP_STR ? > - mem_str(&argv[0]) : mem_str(&argv[1]); > - diag_set(ClientError, ER_INCONSISTENT_TYPES, "string", str); > - context->is_aborted = true; > + assert(argc == 2 || argc == 3); > + struct sql *db = sql_context_db_handle(context); You can get the db after the is_null check below. It is not used when the check passes. > + if (mem_is_any_null(&argv[0], &argv[1])) > return;