Skip to content

Commit 69da361

Browse files
committed
reset @@timestamp for COM_CHANGE_USER
this also fixes tokudb.type_year failure (in ./mtr tokudb.type_timestamp tokudb.type_year)
1 parent 4aacb20 commit 69da361

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

mysql-test/r/change_user.result

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,14 @@ NULL
9090
FLUSH STATUS;
9191
Value of com_select did not change
9292
set global secure_auth=default;
93+
set timestamp=unix_timestamp('2010-10-10 10:10:10');
94+
select now();
95+
now()
96+
2010-10-10 10:10:10
97+
select year(now()) > 2011;
98+
year(now()) > 2011
99+
0
100+
change_user
101+
select year(now()) > 2011;
102+
year(now()) > 2011
103+
1

mysql-test/t/change_user.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,10 @@ if ($after != $before){
142142
echo Value of com_select did not change;
143143

144144
set global secure_auth=default;
145+
146+
set timestamp=unix_timestamp('2010-10-10 10:10:10');
147+
select now();
148+
select year(now()) > 2011;
149+
--echo change_user
150+
--change_user
151+
select year(now()) > 2011;

sql/sql_class.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
945945
statement_id_counter= 0UL;
946946
// Must be reset to handle error with THD's created for init of mysqld
947947
lex->current_select= 0;
948-
user_time.val= start_time= start_time_sec_part= 0;
949948
start_utime= utime_after_query= 0;
950949
utime_after_lock= 0L;
951950
progress.arena= 0;
@@ -1399,6 +1398,8 @@ void THD::init(void)
13991398

14001399
mysql_mutex_unlock(&LOCK_global_system_variables);
14011400

1401+
user_time.val= start_time= start_time_sec_part= 0;
1402+
14021403
server_status= SERVER_STATUS_AUTOCOMMIT;
14031404
if (variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES)
14041405
server_status|= SERVER_STATUS_NO_BACKSLASH_ESCAPES;

0 commit comments

Comments
 (0)