diff --git a/mysql-test/r/change_user.result b/mysql-test/r/change_user.result index 1de97ed02e6..fa934fbf09a 100644 --- a/mysql-test/r/change_user.result +++ b/mysql-test/r/change_user.result @@ -90,3 +90,14 @@ NULL FLUSH STATUS; Value of com_select did not change set global secure_auth=default; +set timestamp=unix_timestamp('2010-10-10 10:10:10'); +select now(); +now() +2010-10-10 10:10:10 +select year(now()) > 2011; +year(now()) > 2011 +0 +change_user +select year(now()) > 2011; +year(now()) > 2011 +1 diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test index c918224520d..d191b1c3ca0 100644 --- a/mysql-test/t/change_user.test +++ b/mysql-test/t/change_user.test @@ -142,3 +142,10 @@ if ($after != $before){ echo Value of com_select did not change; set global secure_auth=default; + +set timestamp=unix_timestamp('2010-10-10 10:10:10'); +select now(); +select year(now()) > 2011; +--echo change_user +--change_user +select year(now()) > 2011; diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c8347d0f585..f460d318791 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -945,7 +945,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) statement_id_counter= 0UL; // Must be reset to handle error with THD's created for init of mysqld lex->current_select= 0; - user_time.val= start_time= start_time_sec_part= 0; start_utime= utime_after_query= 0; utime_after_lock= 0L; progress.arena= 0; @@ -1399,6 +1398,8 @@ void THD::init(void) mysql_mutex_unlock(&LOCK_global_system_variables); + user_time.val= start_time= start_time_sec_part= 0; + server_status= SERVER_STATUS_AUTOCOMMIT; if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES) server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;