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 0F17627C8D for ; Thu, 19 Jul 2018 22:17:04 -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 ceuq-vtojA3H for ; Thu, 19 Jul 2018 22:17:03 -0400 (EDT) Received: from smtp15.mail.ru (smtp15.mail.ru [94.100.176.133]) (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 2D32027C8A for ; Thu, 19 Jul 2018 22:17:03 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: introduce TRUNCATE TABLE operation From: "n.pettik" In-Reply-To: Date: Fri, 20 Jul 2018 05:16:55 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <119B20FA-F3FD-484C-A17E-0B63131CC4DE@tarantool.org> References: <70326bb69fbe25215df79e2d5e01043f93ff7c5a.1531902074.git.kshcherbatov@tarantool.org> <797d52e5-1387-dd3d-1fb2-0fafbbbdcf56@tarantool.org> <606f657b-26df-35b9-ddf1-d5bae5654d82@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 Firstly, you have partially ignored my comment concerning test: I still see no tests on table with triggers (including INSTEAD OF on = VIEW), FK constraints. Also I would add few tests checking syntax correctness. Secondly, AFAIR we discussed that TRUNCATE (until it is DDL) must not = have nothing in common with DELETE. So, implement separate function handling TRUNCATE from parser. It would provide all necessary checks and emit one = opcode: OP_Truncate (or OP_Clear working on truncate mode AYW). > --- a/src/box/sql/parse.y > +++ b/src/box/sql/parse.y > @@ -722,7 +722,16 @@ cmd ::=3D with(C) DELETE FROM fullname(X) = indexed_opt(I) where_opt(W). { > sqlSubProgramsRemaining =3D SQL_MAX_COMPILING_TRIGGERS; > /* Instruct SQL to initate Tarantool's transaction. */ > pParse->initiateTTrans =3D true; > - sql_table_delete_from(pParse,X,W); > + sql_table_delete_from(pParse,X,W,false); > +} > + > +/////////////////////////// The TRUNCATE statement = ///////////////////////////// > +// > +cmd ::=3D TRUNCATE TABLE fullname(X). { > + sqlSubProgramsRemaining =3D SQL_MAX_COMPILING_TRIGGERS; Why is this related to truncate? Truncate and triggers are not = compatible. > + /* Instruct SQL to initate Tarantool's transaction. */ > + pParse->initiateTTrans =3D true; Why do you need to start transaction for truncate?