diff --git a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc index e83c4d2c2..ceb581800 100644 --- a/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc +++ b/query_classifier/qc_mysqlembedded/qc_mysqlembedded.cc @@ -1848,14 +1848,14 @@ int32_t qc_mysql_get_database_names(GWBUF* querybuf, char*** databasesp, int* si goto retblock; } - if (lex->describe || is_show_command(lex->sql_command)) + if (lex->describe || (is_show_command(lex->sql_command) && !(lex->sql_command == SQLCOM_SHOW_TABLES))) { goto retblock; } - if (lex->sql_command == SQLCOM_CHANGE_DB) + if (lex->sql_command == SQLCOM_CHANGE_DB || lex->sql_command == SQLCOM_SHOW_TABLES) { - if (lex->select_lex.db) + if (lex->select_lex.db && (strcmp(lex->select_lex.db, "skygw_virtual") != 0)) { if (i >= currsz) { diff --git a/query_classifier/qc_sqlite/qc_sqlite.cc b/query_classifier/qc_sqlite/qc_sqlite.cc index bb5e4a5a7..d57cbc4e3 100644 --- a/query_classifier/qc_sqlite/qc_sqlite.cc +++ b/query_classifier/qc_sqlite/qc_sqlite.cc @@ -3031,6 +3031,14 @@ public: case MXS_SHOW_TABLES: m_type_mask = QUERY_TYPE_SHOW_TABLES; + if (pShow->pDatabase->z) + { + char db[pShow->pDatabase->n + 1]; + strncpy(db, pShow->pDatabase->z, pShow->pDatabase->n); + db[pShow->pDatabase->n] = 0; + + update_database_names(db); + } break; case MXS_SHOW_VARIABLES: