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;
+ /* Instruct SQL to initate Tarantool's transaction. */
+ pParse->initiateTTrans = true;