<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">пт, 6 апр. 2018 г. в 3:42, Hollow111 <<a href="mailto:hollow653@gmail.com">hollow653@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">чт, 5 апр. 2018 г. в 21:01, n.pettik <<a href="mailto:korablev@tarantool.org" target="_blank">korablev@tarantool.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello.<br>
<br>
See 2 minor remarks. The rest seems to be OK.<br>
<br>
I have noticed, that there are wrong indentations on your branch:<br>
<br>
@@ -2415,7 +2426,7 @@ sqlite3DropTable(Parse * pParse, SrcList * pName, int isView, int noErr)<br>
         */<br>
<br>
        sqlite3BeginWriteOperation(pParse, 1);<br>
-       sqlite3ClearStatTables(pParse, "tbl", pTab->zName);<br>
+    sql_clear_stat_tables(pParse, pTab->zName, NULL);<br>
<br>
@@ -3417,7 +3428,7 @@ sqlite3DropIndex(Parse * pParse, SrcList * pName, Token * pName2, int ifExists)<br>
         * But firstly, delete statistics since schema<br>
         * changes after DDL.<br>
         */<br>
-       sqlite3ClearStatTables(pParse, "idx", pIndex->zName);<br>
+    sql_clear_stat_tables(pParse, pIndex->pTable->zName, pIndex->zName);<br>
<br>
Please, fix them.<br>
<br>
> On 4 Apr 2018, at 19:34, Hollow111 <<a href="mailto:hollow653@gmail.com" target="_blank">hollow653@gmail.com</a>> wrote:<br>
><br>
> @@ -2210,16 +2210,17 @@ sqliteViewResetAll(sqlite3 * db)<br>
>   * Remove entries from the _sql_statN tables (for N in (1, 4))<br>
>   * after a DROP INDEX or DROP TABLE command.<br>
>   *<br>
> - * @param table_name table to be dropped or<br>
> - *                   the table that contains index to be dropped<br>
> - * @param idx_name index to be dropped<br>
> + * @param parse      The parsing context.<br>
> + * @param table_name The table to be dropped or<br>
> + *                   the table that contains index to be dropped.<br>
> + * @param idx_name   Index to be dropped.<br>
>   */<br>
>  static void<br>
> -sql_clear_stat_tables(Parse *parse,<br>
> -               const char *table_name,<br>
> -                    const char *idx_name)<br>
> +sql_clear_stat_tables(Parse *parse, const char *table_name,<br>
> +                      const char *idx_name<br>
> +                     )<br>
<br>
This bracket should be on previous line.<br>
<br>
>  {<br>
> -    if(idx_name) {<br>
> +    if(idx_name != NULL) {<br>
>          sqlite3NestedParse(parse,<br>
>                      "DELETE FROM \"_sql_stat1\" WHERE (\"idx\"=%Q AND "<br>
>                      "\"tbl\"=%Q)",<br>
><br>
<br></blockquote><div><br></div><div>After considering the remarks changes were made for the newer build of Tarantool 2.0:</div><div><br></div><div>diff --git a/src/box/sql/build.c b/src/box/sql/build.c</div><div>index 92f3cb6..7ca4191 100644</div><div>--- a/src/box/sql/build.c</div><div>+++ b/src/box/sql/build.c</div><div>@@ -2128,19 +2128,33 @@ sqliteViewResetAll(sqlite3 * db)</div><div> /**</div><div>  * Remove entries from the _sql_stat1 and _sql_stat4</div><div>  * system spaces after a DROP INDEX or DROP TABLE command.</div><div>- *</div><div>- * @param pParse Parsing context.</div><div>- * @param zType Type of entry to be deleted:</div><div>- * <span style="white-space:pre-wrap">                </span>'idx' or 'tbl' string literal.</div><div>- * @param zName Name of index or table.</div><div>+ * </div><div>+ * @param parse      The parsing context.</div><div>+ * @param table_name The table to be dropped or</div><div>+ *                   the table that contains index to be dropped.</div><div>+ * @param idx_name   Index to be dropped.</div><div>  */</div><div> static void</div><div>-sql_clear_stat_spaces(Parse * pParse, const char *zType, const char *zName)</div><div>+sql_clear_stat_tables(Parse *parse, const char *table_name,</div><div>+                      const char *idx_name)</div><div> {</div><div>-<span style="white-space:pre-wrap">        </span>sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat1\" WHERE \"%s\"=%Q",</div><div>-<span style="white-space:pre-wrap">                  </span>   zType, zName);</div><div>-<span style="white-space:pre-wrap">     </span>sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat4\" WHERE \"%s\"=%Q",</div><div>-<span style="white-space:pre-wrap">                  </span>   zType, zName);</div><div>+    if (idx_name != NULL) {</div><div>+        sqlite3NestedParse(parse,</div><div>+                    "DELETE FROM \"_sql_stat1\" WHERE (\"idx\"=%Q AND "</div><div>+                    "\"tbl\"=%Q)",</div><div>+                    idx_name, table_name);</div><div>+        sqlite3NestedParse(parse,</div><div>+                    "DELETE FROM \"_sql_stat4\" WHERE (\"idx\"=%Q AND "</div><div>+                    "\"tbl\"=%Q)",</div><div>+                    idx_name, table_name);</div><div>+    } else {</div><div>+        sqlite3NestedParse(parse,</div><div>+                    "DELETE FROM \"_sql_stat1\" WHERE \"tbl\"=%Q",</div><div>+                    table_name);</div><div>+        sqlite3NestedParse(parse,</div><div>+                    "DELETE FROM \"_sql_stat4\" WHERE \"tbl\"=%Q",</div><div>+                    table_name);</div><div>+        }</div><div> }</div><div> </div><div> /**</div><div>@@ -2325,7 +2339,7 @@ sql_drop_table(struct Parse *parse_context, struct SrcList *table_name_list,</div><div> <span style="white-space:pre-wrap">  </span> *    tuple with corresponding space_id from _space.</div><div> <span style="white-space:pre-wrap"> </span> */</div><div> </div><div>-<span style="white-space:pre-wrap">    </span>sql_clear_stat_spaces(parse_context, "tbl", space_name);</div><div>+<span style="white-space:pre-wrap">      </span>sql_clear_stat_tables(parse_context, space_name, NULL);</div><div> <span style="white-space:pre-wrap">        </span>struct Table *tab = sqlite3HashFind(&db->pSchema->tblHash, space_name);</div><div> <span style="white-space:pre-wrap">      </span>sqlite3FkDropTable(parse_context, table_name_list, tab);</div><div> <span style="white-space:pre-wrap">       </span>sql_code_drop_table(parse_context, space, is_view);</div><div>@@ -3328,7 +3342,7 @@ sql_drop_index(struct Parse *parse_context, struct SrcList *index_name_list,</div><div> <span style="white-space:pre-wrap">   </span> * But firstly, delete statistics since schema</div><div> <span style="white-space:pre-wrap"> </span> * changes after DDL.</div><div> <span style="white-space:pre-wrap">  </span> */</div><div>-<span style="white-space:pre-wrap">     </span>sql_clear_stat_spaces(parse_context, "idx", index->def->name);</div><div>+<span style="white-space:pre-wrap">  </span>sql_clear_stat_tables(parse_context, table_name, index->def->name);</div><div> <span style="white-space:pre-wrap">      </span>int record_reg = ++parse_context->nMem;</div><div> <span style="white-space:pre-wrap">     </span>int space_id_reg = ++parse_context->nMem;</div><div> <span style="white-space:pre-wrap">   </span>sqlite3VdbeAddOp2(v, OP_Integer, space_id, space_id_reg);</div><div> </div></div></div></blockquote></div></div>