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 2F99B30594 for ; Thu, 6 Jun 2019 14:55:34 -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 oadxCDnPbCup for ; Thu, 6 Jun 2019 14:55:34 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 DDF193051B for ; Thu, 6 Jun 2019 14:55:33 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.8\)) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: create CHAR_LENGTH() and CHARACTER_LENGTH() From: "n.pettik" In-Reply-To: <20190529175752.GA22262@tarantool.org> Date: Thu, 6 Jun 2019 21:55:31 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <7b8049e47b931a2014b92e26436dc264d56231c9.1557321237.git.imeevma@gmail.com> <78A05ED7-1BE9-4DF6-A96C-AD763D7CC969@tarantool.org> <20190529175752.GA22262@tarantool.org> 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 Cc: Imeev Mergen > On 29 May 2019, at 20:57, Mergen Imeev wrote: >=20 > Hi! Thank you for review! My answers and new version below. >=20 > On Tue, May 21, 2019 at 03:58:55PM +0300, n.pettik wrote: >>=20 >>=20 >>> On 8 May 2019, at 16:15, imeevma@tarantool.org wrote: >>>=20 >>> This patch creates SQL functions CHARACTER_LENGTH() and >>> CHAR_LENGTH(). These functions work the same way. Each of them >>> takes only one argument of type TEXT and returns its length. >>=20 >> I see your message in issue description: >>=20 >> =E2=80=9C >> About this function, it was decided that it would be better to >> implement it as "{CHAR_LENGTH | CHARACTER_LENGTH} >> (character value expression)" (without "[USING CHARACTERS]=E2=80=9D) >> =E2=80=9C >>=20 >> Could you please provide explanation of this decision? > Since this issue is not of primary importance, after some > discussion it was decided that it would be too troublesome to > create these functions with the support of =E2=80=9C[USING = CHARACTERS]=E2=80=9D. >=20 >> What then is the difference between length() and char_length()? >>=20 > I think the most noticeable difference is that the CHAR_LENGTH and > CHARACTER_LENGTH functions are described in ANSI, but LENGTH is > not. So the name is the only difference? Why don=E2=80=99t you use lengthFunc = then as an implementation? I guess the main purpose of the ticket not to add just another one synonym, but follow ANSI syntax of function invocation including USING clause. >>> diff --git a/test/sql-tap/func3.test.lua = b/test/sql-tap/func3.test.lua >>> index 6d6411c..a3a548b 100755 >>> --- a/test/sql-tap/func3.test.lua >>> +++ b/test/sql-tap/func3.test.lua >>> @@ -1,6 +1,6 @@ >>> #!/usr/bin/env tarantool >>> test =3D require("sqltester") >>> -test:plan(25) >>> +test:plan(37) >>>=20 >>> --!./tcltestrunner.lua >>> -- 2010 August 27 >>> @@ -284,6 +284,134 @@ test:do_test( >>> return test:execsql "EXPLAIN SELECT = likely(min(1.0+'2.0',4*11))" >>> end, test:execsql "EXPLAIN SELECT min(1.0+'2.0',4*11)=E2=80=9D) >>=20 >> Add test involving invalid utf8 characters. >>=20 > Sorry, I could not understand what it means. Do you mean > something like this (not exactly invalid characters, but > still): > tarantool> box.execute("SELECT CHAR_LENGTH('\u{12345}');") > --- > - metadata: > - name: !!binary Q0hBUl9MRU5HVEgoJ/CSjYUnKQ=3D=3D > type: integer > rows: > - [1] > ... >=20 > I'm not sure if this should be added. > I added a test with utf8 characters. See sql-tap/badutf1.test.lua