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 ED5C171239; Sat, 30 Oct 2021 02:43:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED5C171239 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1635550996; bh=+wwtnOJFzKk/+w7I/+JBbb6ij6F4P4+yn9UiHSyrvEg=; 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=pqRBPCkQrcXlfkUozgSBF+pO+N3ag44PmT2QQJPDHWcLru/l+NAWmcX1xI55p9qQJ tVTPLVQ9MM1jA/k8g34DWafUpgJxSvbcdFw9TxDBnSw0O1M9WnhTJs8dTzn0lHdMyO k0hPexDmjEm0FdWPffx2CQMeR9HbpHh3Va0dNwOE= 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 F190B71233 for ; Sat, 30 Oct 2021 02:42:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org F190B71233 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mgbWM-0007W9-M9; Sat, 30 Oct 2021 02:42:51 +0300 Message-ID: <256a19c0-6b2b-33ad-1086-0e318cc362ec@tarantool.org> Date: Sat, 30 Oct 2021 01:42:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Content-Language: en-US To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org References: <4308263e-95f4-9c97-f284-a4ff4136ec26@tarantool.org> <20211025083009.GD36295@tarantool.org> In-Reply-To: <20211025083009.GD36295@tarantool.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD98893113B6235BE919ECA157A254E6E778771CCD3CA08B4A8182A05F538085040E6541CFF622185E7AEDB08369466FB53C6264E42DCF6D4E5EF1CD20BE82D8EC0 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7370F4F695FFFC24BEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063781E06E36B00F36668638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8C0823F4FEE22E039970C0B3D75EA7F5C117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3733B5EC72352B9FA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10F2CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B6CF11E2829993B7FCEFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505C29A494506F32D84BFB9A4D56DD213CF X-C1DE0DAB: 0D63561A33F958A5F480A4D3D3F9C2D040E2682438CB9BBCB4280C6251C0D9C1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75C69C5C0DDE134364410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D345C110A855FC09999DD2D3BFFD07097464AE996E7BB05485C885E9022CC99956DA44D762B6278D11F1D7E09C32AA3244C0AC40A73D3C313741F8704B43763191F5595C85A795C7BAE729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj4X0lO6iC8i+MPOwMDWsy0w== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DFFB989E55C4E340B853EB215B84B8CC83841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v1 04/21] sql: refactor LENGTH() 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" >>> diff --git a/src/box/sql/func.c b/src/box/sql/func.c >>> index e5d763be1..863dbf1c4 100644 >>> --- a/src/box/sql/func.c >>> +++ b/src/box/sql/func.c >>> @@ -833,6 +833,19 @@ func_hex(struct sql_context *ctx, int argc, struct Mem *argv) >>> mem_set_str_allocated(ctx->pOut, str, size); >>> } >>> >>> +/** Implementation of the OCTET_LENGTH() function. */ >>> +static void >>> +func_octet_length(struct sql_context *ctx, int argc, struct Mem *argv) >> >> Why is the function LENGTH defined as 'octet_length' instead of just 'length'? > ANSI defines two functions: CHAR_LENGTH() (with CHARACTER_LENGTH() as the other > name) and OCTET_LENGTH(). The first accepts only STRING values and returns the > length in characters or length in octets (depending on the USING clause). The > second accepts VARBINARY or STRING and returns the length in octets. > > We have a LENGTH() function that returns the character length if the argument is > STRING, and the octet length if the argument is VARBINARY. > > Since I am planning to introduce the USING clause, I find it better to use the > CHAR_LENGTH() and OCTET_LENGTH() implementations for LENGTH() depending on the > type of the argument. The func_octet_length() function will be used cases such > as this: > SELECT char_length(string_value USING OCTETS); > > At the moment, I have no plans to introduce OCTET_LENGTH(). Does ANSI define 'USING' or 'OCTET_LENGTH'? Or both?