diff options
-rw-r--r-- | sql/mysqld.cc | 4 | ||||
-rw-r--r-- | sql/sql_class.cc | 5 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 15 |
3 files changed, 20 insertions, 4 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b8bb63c4259..784bfaa58b0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2962,10 +2962,6 @@ static bool cache_thread(THD *thd) _db_pop_(); #endif - /* Clear warnings. */ - if (!thd->get_stmt_da()->is_warning_info_empty()) - thd->get_stmt_da()->clear_warning_info(thd->query_id); - set_timespec(abstime, THREAD_CACHE_TIMEOUT); while (!abort_loop && ! wake_thread && ! kill_cached_threads) { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index bd41a3729d6..e581ed0af25 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1332,6 +1332,11 @@ void THD::change_user(void) cleanup_done= 0; reset_killed(); thd_clear_errors(this); + + /* Clear warnings. */ + if (!get_stmt_da()->is_warning_info_empty()) + get_stmt_da()->clear_warning_info(0); + init(); stmt_map.reset(); my_hash_init(&user_vars, system_charset_info, USER_VARS_HASH_SIZE, 0, 0, diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 99cee8f7ed4..bb72e8b575d 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -16348,6 +16348,7 @@ static void test_change_user() const char *db= "mysqltest_user_test_database"; int rc; MYSQL* conn; + MYSQL_RES* res; DBUG_ENTER("test_change_user"); myheader("test_change_user"); @@ -16484,6 +16485,20 @@ static void test_change_user() rc= mysql_change_user(conn, user_pw, pw, ""); myquery(rc); + /* MDEV-14581 : Check that there are no warnings after change user.*/ + rc = mysql_query(conn,"SIGNAL SQLSTATE '01000'"); + myquery(rc); + + rc = mysql_change_user(conn, user_pw, pw, ""); + myquery(rc); + + rc = mysql_query(conn, "SHOW WARNINGS"); + myquery(rc); + res = mysql_store_result(conn); + rc = my_process_result_set(res); + DIE_UNLESS(rc == 0); + mysql_free_result(res); + rc= mysql_change_user(conn, user_no_pw, pw, db); DIE_UNLESS(rc); if (! opt_silent) |