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 C9B27296FC for ; Mon, 10 Sep 2018 17:53:07 -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 yQbLqT2heIqc for ; Mon, 10 Sep 2018 17:53:07 -0400 (EDT) Received: from smtp1.mail.ru (smtp1.mail.ru [94.100.179.111]) (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 8AB3A285DF for ; Mon, 10 Sep 2018 17:53:07 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH v1 3/3] sql: dissallow bindings for DDL From: "n.pettik" In-Reply-To: <105d3104-aa3e-4834-ea31-fca817bad47e@tarantool.org> Date: Tue, 11 Sep 2018 00:52:59 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <661DC330-826B-41DC-A729-BBA9677CAD06@tarantool.org> References: <5049d3e7b70b7091c51ac99fc64f14a07c879c8a.1535730218.git.kshcherbatov@tarantool.org> <105d3104-aa3e-4834-ea31-fca817bad47e@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 > sql: dissallow bindings for DDL >=20 > Bindings could not be used in stored ASTs because they allocate > memory registers and process assignments during parsing(temporal = register > should be allocated for each variable in parse context, but it is = temporal). > Original sqlite3 did validations that AST to be persisted doesn't = have > auto-assigment Varibles on triggers and checks creation. > On DDL integration completion we've got rid this mechanism. > Now it should be returned. > We use flag 'parse_only' which is set by parser on compiling AST to > determine attempt to use bindings in DDL(triggers, defaults and = checks > creation) that is incorrect and raise an error. >=20 > Closes #3653. Please, don=E2=80=99t *silently* skip my comments (yep, still they are = minor but should be taken into consideration since the rest of patch is OK): =E2=80=98'' Could we keep previous error message? It looks satisfactory actually. The same for triggers: could we use message like =E2=80=9CFailed to create trigger =E2=80=98=E2=80=A6=E2=80=99: = parameters prohibited in trigger definition=E2=80=9D? Or present your persuasive arguments :) =E2=80=98=E2=80=99=E2=80=99 I =E2=80=98member that we discussed smth about error messages but really can=E2=80=99t recall exactly what. So, please, answer on this nit or fix = it. > diff --git a/test/sql/checks.test.lua b/test/sql/checks.test.lua > index fb95809..3506d5c 100644 > --- a/test/sql/checks.test.lua > +++ b/test/sql/checks.test.lua > @@ -43,11 +43,27 @@ format =3D {{name =3D 'X', type =3D 'unsigned'}} > t =3D {513, 1, 'test', 'memtx', 0, opts, format} > s =3D box.space._space:insert(t) >=20 > - > -- > -- gh-3611: Segfault on table creation with check referencing this = table > -- > box.sql.execute("CREATE TABLE w2 (s1 INT PRIMARY KEY, CHECK ((SELECT = COUNT(*) FROM w2) =3D 0));") > box.sql.execute("DROP TABLE w2;") >=20 > +-- > +-- gh-3653: Dissallow bindings for DDL > +-- > +box.sql.execute("CREATE TABLE t1(a INT PRIMARY KEY, b INT);") > +space_id =3D box.space.T1.id > +box.sql.execute("CREATE TRIGGER tr1 AFTER INSERT ON t1 WHEN new.a =3D = ? BEGIN SELECT 1; END;") > +tuple =3D {"TR1", space_id, {sql =3D [[CREATE TRIGGER tr1 AFTER = INSERT ON t1 WHEN new.a =3D ? BEGIN SELECT 1; END;]]}} This test should be moved to test/sql/triggers.test.lua (Since this test is about checks only).