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 A410D2CBD2 for ; Thu, 25 Apr 2019 16:38:54 -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 RZftB1G7tFAB for ; Thu, 25 Apr 2019 16:38:54 -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 5FCC626654 for ; Thu, 25 Apr 2019 16:38:54 -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 v3 3/3] box: user-friendly interface to manage ck constraints From: "n.pettik" In-Reply-To: <0511eb70cd35f5a3b8fc527e5e08814f3188eb15.1555420166.git.kshcherbatov@tarantool.org> Date: Thu, 25 Apr 2019 23:38:52 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <4D153269-CCBF-414E-A21A-02EA11979838@tarantool.org> References: <0511eb70cd35f5a3b8fc527e5e08814f3188eb15.1555420166.git.kshcherbatov@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: Kirill Shcherbatov > On 16 Apr 2019, at 16:51, Kirill Shcherbatov = wrote: >=20 > @TarantoolBot document > Title: check constraint for LUA space >=20 > The check constraint is a type of integrity constraint which > specifies a requirement that must be met by tuple before it > is inserted into space. The constraint result must be predictable. Expression in check constraint must be I.e. return boolean result. > Now it is possible to create ck constraints only for empty space > having format. Constraint expression is a string that defines > relations between top-level tuple fields. > Take into account that all names are converted to an uppercase > before resolve(like SQL does), use \" sign for names of fields > that were created not with SQL. Describe please new order of execution: SQL triggers, NoSQL triggers, check constraints and fk contraints. And order between checks themselves. Original check implementation executed check constraints before NoSQL triggers. > To create a new CK constraint for a space, use > s =3D box.schema.create_space('person') > _ =3D s:create_index('pk', {parts =3D {1, 'string'}}) > s:format({{name=3D'name', type=3D'string'}, {name=3D'age', = type=3D'integer'}, > {name=3D'experience', type=3D'integer'}}) > s:ck_constraint({'physics', '\"age\" > 14 and \"experience\" < > \"age\"=E2=80=99}) Why not s:create_ck_constraint() OR s:create_check(). Let's discuss names and methods in our server chat. So, now I won=E2=80=99t review code in patch since it may significantly = change.