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 2C9876EC58; Wed, 26 May 2021 01:58:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2C9876EC58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621983538; bh=DE/w8Cuo4oeDVCM1ZvbzoU2K/f0i8gvpmNuErbelCO8=; h=To:Cc:References:In-Reply-To:Date:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=CXheuY1u3R+LYPWjeSzny3yweRRnSZZXjfMX+Ve2nCZMlsw1UIFYykLt9tcuA0JbU nveLuQFxsrsW3qgyrdN62+wIHLB/2BVVRxjLCytjhMPu7Qo33m38hhA1f/8VmyooiM lO1k4A34C+nHWvHy4vtTV0X/h7QDL96guGHSkOf4= Received: from smtp46.i.mail.ru (smtp46.i.mail.ru [94.100.177.106]) (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 957576EC58 for ; Wed, 26 May 2021 01:58:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 957576EC58 Received: by smtp46.i.mail.ru with esmtpa (envelope-from ) id 1llg0m-0007uu-NQ; Wed, 26 May 2021 01:58:57 +0300 To: "'Mergen Imeev'" , "'Vladislav Shpilevoy'" Cc: "TML" References: <9d53f29d460d7a4194cb3f95de4b5a4016453db3.1621503852.git.imeevma@gmail.com> <2cf25c21-9522-446d-3cf9-d36e0523d24b@tarantool.org> <20210525141313.GA81084@tarantool.org> In-Reply-To: <20210525141313.GA81084@tarantool.org> Date: Wed, 26 May 2021 01:58:41 +0300 Message-ID: <158401d751b9$82223b00$8666b100$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQESTYuyeGRVI4CvRIg2I0ojqpIWMgGYmW2ZAdj08BKsY0I+gA== Content-Language: ru X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD9F4D89F53055293B7E6C4BEBBE5B0FBDB9CA426C42FFF0998182A05F5380850400170D4C0D8C8C02D6585E310D1F71DA6D68C3D35707DB3CB41ED27AAF746CF40 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE749E89BD568380EECC2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7DC6E0FF9A9D6BE87EA1F7E6F0F101C6723150C8DA25C47586E58E00D9D99D84E1BDDB23E98D2D38BD6CF32B5F8F9D404CC5563E333152D10B75EA25497808E02CC7F00164DA146DAFE8445B8C89999728AA50765F79006372A3B24BF85B2E607389733CBF5DBD5E9C8A9BA7A39EFB766F5D81C698A659EA7CC7F00164DA146DA9985D098DBDEAEC80CABCCA60F52D7EBF6B57BC7E6449061A352F6E88A58FB86F5D81C698A659EA73AA81AA40904B5D9A18204E546F3947C92349F04B73BB8DAC0837EA9F3D197644AD6D5ED66289B52698AB9A7B718F8C46E0066C2D8992A16725E5C173C3A84C3F76ED8DA7750D051BA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE7588D3C263EAE74EA731C566533BA786AA5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4AD8B26749FD21939CAF7445A00121C0357 X-C1DE0DAB: 0D63561A33F958A539B327E6CC4F1F4FF9738A45D3D3F00D51F0557F9267B192D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA753C350047980234DB410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AC632F0BE69382F3F37FA4A63950BFDD5E5DCCF3A3C68C053333FDC534DDA2FAF4A50BB69CF17F1E1D7E09C32AA3244CD1AEF9503DA404D3B5451E91250831343FD9C8CA1B0515E0FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojV3CWresp27eN0igN8Ge6RA== X-Mailru-Sender: 6CA451E36783D721CBEA96CEA26D325DA9A844FA3E0E272BA32F2186AA75E5B8B7CBEF92542CD7C82F97C478340294DCC77752E0C033A69E0F0C7111264B8915FF1320A92A5534336C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/1] sql: introduce UUID field type 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: Timur Safin via Tarantool-patches Reply-To: Timur Safin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" There is one major issue I'd like to discuss, please see below... : From: Mergen Imeev : Subject: Re: [Tarantool-patches] [PATCH 1/1] sql: introduce UUID field type : ... : +static inline int : +str_to_uuid(struct Mem *mem) : +{ : + assert(mem->type == MEM_TYPE_STR); : + struct tt_uuid uuid; : + if (mem->n != UUID_STR_LEN || : + tt_uuid_from_string(tt_cstr(mem->z, mem->n), &uuid) != 0) Here lies the limitation I've specifically wanted to avoid and put below to RFC: "The most complete implementation seemingly is in PostgreSQL, which allows various relaxed formats for string literals which may be accepted as UUID - the plan is to be as close as possible to PostgreSQL here." Checking for UUID_STR_LEN restricts only to 1 specific form with dashes in specific positions, but we would rather want to allow relaxed formats also, with some dashes omitted. Also with optional braces around. i.e. putting this as regexp \{?[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}\}? And yes, I mean we need to reimplement tt_uuid_from_string() differently. (If you were asking me then I'd use RE2C for that purpose, but that up to you) : + return -1; : + mem_set_uuid(mem, &uuid); : + return 0; : +} : + : static inline int : str_to_bool(struct Mem *mem) : { ... : diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h : index 15d97da0e..b3cd5c545 100644 : --- a/src/box/sql/mem.h : +++ b/src/box/sql/mem.h : @@ -30,6 +30,7 @@ : * SUCH DAMAGE. : */ : #include "box/field_def.h" : +#include "uuid/tt_uuid.h" : : struct sql; : struct Vdbe; : @@ -47,10 +48,11 @@ enum mem_type { : MEM_TYPE_MAP = 1 << 6, : MEM_TYPE_BOOL = 1 << 7, : MEM_TYPE_DOUBLE = 1 << 8, : - MEM_TYPE_INVALID = 1 << 9, : - MEM_TYPE_FRAME = 1 << 10, : - MEM_TYPE_PTR = 1 << 11, : - MEM_TYPE_AGG = 1 << 12, : + MEM_TYPE_UUID = 1 << 9, : + MEM_TYPE_INVALID = 1 << 10, : + MEM_TYPE_FRAME = 1 << 11, : + MEM_TYPE_PTR = 1 << 12, : + MEM_TYPE_AGG = 1 << 13, I guess there should be no incompatibility problems here, but just in case I ask - why did you insert new constant to the middle of prior list? Also I see there is another omission from RFC - there is nothing added for SQL built-in support to generate UUID from within SQL mode. "Introduce UUID([version#]) functions which would allow generating any particular type of GUID. If version argument is omitted then we generate UUID v4 (as used by default in box);" Regards, Timur