[tarantool-patches] Re: [PATCH v1 1/1] sql: introduce TRUNCATE TABLE operation

n.pettik korablev at tarantool.org
Fri Jul 20 05:16:55 MSK 2018


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?





More information about the Tarantool-patches mailing list