From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp5.mail.ru (smtp5.mail.ru [94.100.179.24]) (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 E9354441841 for ; Fri, 27 Mar 2020 19:54:17 +0300 (MSK) Date: Fri, 27 Mar 2020 16:54:17 +0000 From: Nikita Pettik Message-ID: <20200327165417.GD9287@tarantool.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH v4 2/3] sql: fix implicit cast from STRING to INTEGER List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org On 27 Mar 14:33, imeevma@tarantool.org wrote: > Prior to this patch, STRING, which contains the DOUBLE value, > could be implicitly cast to INTEGER. This was done by converting > STRING to DOUBLE and then converting this DOUBLE value to INTEGER. > This may affect the accuracy of CAST(), so it was forbidden. > > Example: > box.execute("CREATE TABLE t(i INT PRIMARY KEY);") > > Before patch: > box.execute("INSERT INTO t VALUES ('111.1');") > box.execute("SELECT * FROM t;") > Result: 111 > > After patch: > box.execute("INSERT INTO t VALUES ('1.1');") > Result: 'Type mismatch: can not convert 1.1 to integer' > > box.execute("INSERT INTO t VALUES ('1.0');") > Result: 'Type mismatch: can not convert 1.0 to integer' > > box.execute("INSERT INTO t VALUES ('1.');") > Result: 'Type mismatch: can not convert 1. to integer' Is comparison predicat affected? > Part of #4766 > > @TarantoolBot document > Title: disallow cast from STRING contais DOUBLE to INTEGER -> contains > diff --git a/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua b/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua > index 0865c4e..559e33d 100755 > --- a/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua > +++ b/test/sql-tap/gh-4766-wrong-cast-from-blob-to-int.test.lua Same nit concerning test file as in previous patch: personally I'd not introduce it.