Skip to content

Commit

Permalink
reset @@timestamp for COM_CHANGE_USER
Browse files Browse the repository at this point in the history
this also fixes tokudb.type_year failure
(in ./mtr tokudb.type_timestamp tokudb.type_year)
  • Loading branch information
vuvova committed Jun 4, 2016
1 parent 4aacb20 commit 69da361
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions mysql-test/r/change_user.result
Expand Up @@ -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
7 changes: 7 additions & 0 deletions mysql-test/t/change_user.test
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion sql/sql_class.cc
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 69da361

Please sign in to comment.