diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index eb992d770..2d48cb215 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -1793,17 +1793,27 @@ static bool should_exclude(const char* name, List* excludep) while (!exclude && (exclude_item = ilist++)) { - const char* exclude_name = exclude_item->full_name(); - - if (strchr(exclude_name, '.') == NULL) - { - exclude_name = exclude_item->name; - } + const char* exclude_name = exclude_item->name; if (exclude_name && (strcasecmp(name, exclude_name) == 0)) { exclude = true; } + + if (!exclude) + { + exclude_name = strrchr(exclude_item->full_name(), '.'); + + if (exclude_name) + { + ++exclude_name; // Char after the '.' + + if (strcasecmp(name, exclude_name) == 0) + { + exclude = true; + } + } + } } return exclude; diff --git a/query_classifier/qc_sqlite/qc_sqlite.c b/query_classifier/qc_sqlite/qc_sqlite.c index 30839fcd5..eae3f00ab 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.c +++ b/query_classifier/qc_sqlite/qc_sqlite.c @@ -663,6 +663,18 @@ static bool should_exclude(const char* zName, const ExprList* pExclude) Expr* pExpr = item->pExpr; + if (pExpr->op == TK_EQ) + { + // We end up here e.g with "UPDATE t set t.col = 5 ..." + // So, we pick the left branch. + pExpr = pExpr->pLeft; + } + + while (pExpr->op == TK_DOT) + { + pExpr = pExpr->pRight; + } + if (pExpr->op == TK_ID) { // We need to ensure that we do not report fields where there @@ -1596,7 +1608,7 @@ void mxs_sqlite3Update(Parse* pParse, SrcList* pTabList, ExprList* pChanges, Exp if (pWhere) { - update_fields_infos(info, 0, pWhere, QC_TOKEN_MIDDLE, NULL); + update_fields_infos(info, 0, pWhere, QC_TOKEN_MIDDLE, pChanges); } exposed_sqlite3SrcListDelete(pParse->db, pTabList);