MDEV-14581 Server does not clear diagnostics between sessions
Amend previous patch, so it works in all cases (also for "change user" command, and for RESET CONNECTION in 10.3)
This commit is contained in:
parent
33fadbfefc
commit
7fefd53f94
@ -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)
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user