Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v1 1/1] sql: introduce TRUNCATE TABLE operation
Date: Fri, 20 Jul 2018 05:16:55 +0300	[thread overview]
Message-ID: <119B20FA-F3FD-484C-A17E-0B63131CC4DE@tarantool.org> (raw)
In-Reply-To: <bae235a0-1468-dc2e-d4de-5e9ba4f8af9d@tarantool.org>

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 ::= with(C) DELETE FROM fullname(X) indexed_opt(I) where_opt(W). {
>   sqlSubProgramsRemaining = SQL_MAX_COMPILING_TRIGGERS;
>   /* Instruct SQL to initate Tarantool's transaction.  */
>   pParse->initiateTTrans = true;
> -  sql_table_delete_from(pParse,X,W);
> +  sql_table_delete_from(pParse,X,W,false);
> +}
> +
> +/////////////////////////// The TRUNCATE statement /////////////////////////////
> +//
> +cmd ::= TRUNCATE TABLE fullname(X). {
> +  sqlSubProgramsRemaining = 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 = true;

Why do you need to start transaction for truncate?

  reply	other threads:[~2018-07-20  2:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-18  8:22 [tarantool-patches] " Kirill Shcherbatov
2018-07-18  8:31 ` [tarantool-patches] " Vladislav Shpilevoy
2018-07-18 13:01   ` Kirill Shcherbatov
2018-07-18 16:40     ` n.pettik
2018-07-19  9:01       ` Kirill Shcherbatov
2018-07-19 10:00       ` Kirill Shcherbatov
2018-07-20  2:16         ` n.pettik [this message]
2018-07-20  8:29           ` Kirill Shcherbatov
2018-07-20 16:33             ` n.pettik
2018-07-23 10:33               ` Kirill Shcherbatov
2018-07-25 12:58                 ` n.pettik
2018-07-25 16:59                   ` Kirill Shcherbatov
2018-07-26  9:10                     ` n.pettik
2018-07-26 20:40 ` Vladislav Shpilevoy
2018-07-27  7:09   ` Kirill Shcherbatov
2018-07-27  7:16 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=119B20FA-F3FD-484C-A17E-0B63131CC4DE@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v1 1/1] sql: introduce TRUNCATE TABLE operation' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox