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 AEAFC6B967; Wed, 14 Apr 2021 02:00:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org AEAFC6B967 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618354808; bh=vhQmBnS3Nlh6zbe5OZj4ImuUVut352ByS30ATZL5E1I=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=kE/Klv4eN94DBIbZik6QSKdhH8vjN3sVqYVwDPNhSfT8mg/JPpqzh8YFJbpttXRb1 f99JmqVJidHbV2fq7gntxkTnu5VeEzlZo6GgNJAtfs1wqlPauGo1kzlUOkUiKKnm/n S1VfWDxi0+qD8X2B2gUERf2NzpqvM0zxBuz7aoOA= Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 6ED346EC5B for ; Wed, 14 Apr 2021 02:00:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6ED346EC5B Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1lWS0l-0006ZA-LG; Wed, 14 Apr 2021 02:00:00 +0300 To: imeevma@tarantool.org, tsafin@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: <1e61942aa006bb53457006df9b80fc9d0e5aab0a.1618000037.git.imeevma@gmail.com> Message-ID: <3a3eea86-4fc4-84db-14fd-fd8fdc541379@tarantool.org> Date: Wed, 14 Apr 2021 00:59:58 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <1e61942aa006bb53457006df9b80fc9d0e5aab0a.1618000037.git.imeevma@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D0F00AE41BB9A5343182A05F538085040BAD493A0E80FF53C32E0CD4F3DD577213A6C25504E5D3561BAE60959DE068E07 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77D079F75B39C9378C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7B9EA053ECF1425EFEA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA65847103AFCBCE69BFCCE7023809C6AA5B7F6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249D082881546D93491CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C07E7E81EEA8A9722B8941B15DA834481F9449624AB7ADAF372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F83C798A30B85E16BA91E23F1B6B78B78B5C8C57E37DE458BEDA766A37F9254B7 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C978317F9D6E0796D64B7D285D1CF7EB47FA2E X-C1DE0DAB: 0D63561A33F958A5AD98A3D2A9E74B3558E945374F7BB9A334B42CC1B2178782D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A9A0A0BF1A2CAC6235274FF2B3668F09801D121095000F5FBAB1EDEB12B80536169F4C62EF5F555D1D7E09C32AA3244C04C5612266A58561440E4D0978464BBA30363D8B7DA7DD44FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXEOMVY2vj03dg== X-Mailru-Sender: 689FA8AB762F73936BC43F508A063822E40A28CC5069B358FCF7B29B76ECD3203841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 44/52] sql: introduce mem_cast_implicit() 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" Good job on the fixes! > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > index 29634841a..72a84e80d 100644 > --- a/src/box/sql/vdbe.c > +++ b/src/box/sql/vdbe.c > @@ -2092,23 +2092,12 @@ case OP_ApplyType: { > while((type = *(types++)) != field_type_MAX) { > assert(pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)]); > assert(memIsValid(pIn1)); > - if (!mem_is_type_compatible(pIn1, type)) { > - /* Implicit cast is allowed only to numeric type. */ > - if (!sql_type_is_numeric(type)) > - goto type_mismatch; > - /* Implicit cast is allowed only from numeric type. */ > - if (!mem_is_num(pIn1)) > - goto type_mismatch; > - /* Try to convert numeric-to-numeric. */ > - if (mem_cast_explicit(pIn1, type) != 0) > - goto type_mismatch; > + if (mem_cast_implicit(pIn1, type) != 0) { > + diag_set(ClientError, ER_SQL_TYPE_MISMATCH, > + mem_str(pIn1), field_type_strs[type]); > + goto abort_due_to_error; I think it would be better both for explicit and implicit casts to have the diag_set() inside.