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 445752A022 for ; Thu, 6 Sep 2018 09:05:03 -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 mTnI50WpXjEw for ; Thu, 6 Sep 2018 09:05:03 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 0213E29F7C for ; Thu, 6 Sep 2018 09:05:02 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v1 3/3] sql: dissallow bindings for DDL References: <5049d3e7b70b7091c51ac99fc64f14a07c879c8a.1535730218.git.kshcherbatov@tarantool.org> From: Kirill Shcherbatov Message-ID: <105d3104-aa3e-4834-ea31-fca817bad47e@tarantool.org> Date: Thu, 6 Sep 2018 16:04:58 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit 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, Nikita Pettik > Previous two patches looks OK to me. >> Bindings could not be used in stored ACTs because they allocate > Nit: “AST”. >> memory registers and makes > Nit: “make” (or better “process"). >> assignments on parse sequentially. > Nit: “during parsing”. > Also, I guess problem is quite more sophisticated as it seems: > a) For check constraint bindings really make no sense > (I can’t come up with example how they can be used there at all). > b) For triggers currently we don’t have proper mechanism, which > would allow to use bindings. Original SQLite also lacks it. > To reuse the same trigger’s body with different parameters we should > not only be able to store it as prepared statement and substitute literals, > but also give trigger new name. >> Original sqlite3 did validations that persistent AST doesn't have >> auto-assigment Varibles on triggers and checks creation. >> On DDL integration complete we've get rid this mechanism. > Nits: “completion”, “got rid of”. >> Now it should be returned. > > Well, actually your approach is slightly different: explain that > DDL (to be more precise - triggers and checks creation) relies on > parse_only flag in parser. Hence, you can check it and throw an > error during parsing. sql: dissallow bindings for DDL 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. Closes #3653.