<div dir="ltr">Hello. Here's the diff for the changes:<br><br><div>diff --git a/src/box/sql/build.c b/src/box/sql/build.c</div><div>index 92f3cb6..0287183 100644</div><div>--- a/src/box/sql/build.c</div><div>+++ b/src/box/sql/build.c</div><div>@@ -2129,18 +2129,32 @@ sqliteViewResetAll(sqlite3 * db)</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">             </span>'idx' or 'tbl' string literal.</div><div>- * @param zName Name of index or table.</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_spaces(Parse *parse, const char *table_name,</div><div>+<span style="white-space:pre">                         </span>const char *idx_name)</div><div> {</div><div>-<span style="white-space:pre">      </span>sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat1\" WHERE \"%s\"=%Q",</div><div>-<span style="white-space:pre">                       </span>   zType, zName);</div><div>-<span style="white-space:pre">  </span>sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat4\" WHERE \"%s\"=%Q",</div><div>-<span style="white-space:pre">                       </span>   zType, zName);</div><div>+<span style="white-space:pre">  </span>if (idx_name != NULL) {</div><div>+<span style="white-space:pre">      </span>sqlite3NestedParse(parse,</div><div>+<span style="white-space:pre">                                    </span>"DELETE FROM \"_sql_stat1\" WHERE (\"idx\"=%Q AND "</div><div>+<span style="white-space:pre">                                    </span>"\"tbl\"=%Q)",</div><div>+<span style="white-space:pre">                                   </span>idx_name, table_name);</div><div>+<span style="white-space:pre">               </span>sqlite3NestedParse(parse,</div><div>+<span style="white-space:pre">                                    </span>"DELETE FROM \"_sql_stat4\" WHERE (\"idx\"=%Q AND "</div><div>+<span style="white-space:pre">                                    </span>"\"tbl\"=%Q)",</div><div>+<span style="white-space:pre">                                   </span>idx_name, table_name);</div><div>+<span style="white-space:pre">       </span>} else {</div><div>+<span style="white-space:pre">             </span>sqlite3NestedParse(parse,</div><div>+<span style="white-space:pre">                                    </span>"DELETE FROM \"_sql_stat1\" WHERE \"tbl\"=%Q",</div><div>+<span style="white-space:pre">                                 </span>table_name);</div><div>+<span style="white-space:pre">         </span>sqlite3NestedParse(parse,</div><div>+                    "DELETE FROM \"_sql_stat4\" WHERE \"tbl\"=%Q",</div><div>+<span style="white-space:pre">                                  </span>table_name);</div><div>+<span style="white-space:pre">                                 </span>}</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">   </span> *    tuple with corresponding space_id from _space.</div><div> <span style="white-space:pre">      </span> */</div><div> </div><div>-<span style="white-space:pre"> </span>sql_clear_stat_spaces(parse_context, "tbl", space_name);</div><div>+<span style="white-space:pre">   </span>sql_clear_stat_spaces(parse_context, space_name, NULL);</div><div> <span style="white-space:pre">     </span>struct Table *tab = sqlite3HashFind(&db->pSchema->tblHash, space_name);</div><div> <span style="white-space:pre">   </span>sqlite3FkDropTable(parse_context, table_name_list, tab);</div><div> <span style="white-space:pre">    </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">        </span> * But firstly, delete statistics since schema</div><div> <span style="white-space:pre">      </span> * changes after DDL.</div><div> <span style="white-space:pre">       </span> */</div><div>-<span style="white-space:pre">  </span>sql_clear_stat_spaces(parse_context, "idx", index->def->name);</div><div>+<span style="white-space:pre">       </span>sql_clear_stat_spaces(parse_context, table_name, index->def->name);</div><div> <span style="white-space:pre">   </span>int record_reg = ++parse_context->nMem;</div><div> <span style="white-space:pre">  </span>int space_id_reg = ++parse_context->nMem;</div><div> <span style="white-space:pre">        </span>sqlite3VdbeAddOp2(v, OP_Integer, space_id, space_id_reg);</div><br><div class="gmail_quote"><div dir="ltr">пн, 9 апр. 2018 г. в 15:16, n.pettik <<a href="mailto:korablev@tarantool.org">korablev@tarantool.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello. I have noticed that you are using 4 spaces as an indentation.<div>According to our codestyle, we use tab symbol, instead of spaces,</div><div>which is equal to 8 spaces.</div><div><br></div><div>Also, I don’t see any point in renaming function:</div><div>’sql_clear_stat_spaces’ -> ’sql_clear_stat_tables’.</div><div>I would even say that ‘spaces’ is more appropriate name,</div><div>since stat tables in fact are Tarantool’s system spaces.</div><div><br><div><blockquote type="cite"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><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><br></div><div> </div></div></div></blockquote></div></div>
</blockquote></div><br></div></div></blockquote></div></div>