SET STATEMENT incorrectly restores values of some variables

Bug #1341606 reported by Oleksandr "Sanja" Byelkin on 2014-07-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server
Status tracked in 5.7
5.5
Undecided
Unassigned
5.6
High
Unassigned
5.7
High
Unassigned

Bug Description

For some variables which hase not simple value setting procedure SET TATEMENT works incorrectly (problem is in the way how values of the variables stored and restored). Here is test suite:

--echo #Correctly set timestamp
set session timestamp=4646464;
select @@timestamp;
select @@timestamp;
--echo #Correctly returned normal behaviour
set session timestamp=default;
select @@timestamp;
select @@timestamp;
--echo #here timestamp should be set only for the statement then restored default
set statement timestamp=4646464 for select @@timestamp;
select @@timestamp;
select @@timestamp;

Result of the above execution shows that after SET STATEMENT default value is not restored:

#Correctly set timestamp
set session timestamp=4646464;
select @@timestamp;
@@timestamp
4646464.000000
select @@timestamp;
@@timestamp
4646464.000000
#Correctly returned normal behaviour
set session timestamp=default;
select @@timestamp;
@@timestamp
1405348645.221255
select @@timestamp;
@@timestamp
1405348645.221572
#here timestamp should be set only for the statement then restored default
set statement timestamp=4646464 for select @@timestamp;
@@timestamp
4646464.000000
select @@timestamp;
@@timestamp
4646464.000000
select @@timestamp;
@@timestamp
4646464.000000

tags: added: set-statement

This is easy to confirm:

[openxs@chief p5.6]$ bin/mysql --no-defaults -uroot test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17-65.0 MySQL Community Server (GPL)

Copyright (c) 2009-2014 Percona LLC and/or its affiliates
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set session timestamp=4646464;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@timestamp;
+----------------+
| @@timestamp |
+----------------+
| 4646464.000000 |
+----------------+
1 row in set (0.00 sec)

mysql> select @@timestamp;
+----------------+
| @@timestamp |
+----------------+
| 4646464.000000 |
+----------------+
1 row in set (0.00 sec)

mysql> set session timestamp=default;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@timestamp;
+-------------------+
| @@timestamp |
+-------------------+
| 1405411683.154843 |
+-------------------+
1 row in set (0.00 sec)

mysql> select @@timestamp;
+-------------------+
| @@timestamp |
+-------------------+
| 1405411684.197364 |
+-------------------+
1 row in set (0.00 sec)

mysql> set statement timestamp=4646464 for select @@timestamp;
+----------------+
| @@timestamp |
+----------------+
| 4646464.000000 |
+----------------+
1 row in set (0.00 sec)

mysql> select @@timestamp;
+----------------+
| @@timestamp |
+----------------+
| 4646464.000000 |
+----------------+
1 row in set (0.00 sec)

mysql> select @@timestamp;
+----------------+
| @@timestamp |
+----------------+
| 4646464.000000 |
+----------------+
1 row in set (0.00 sec)

summary: - SET STATEMENT incorrectly restore vaues of some variables
+ SET STATEMENT incorrectly restores values of some variables
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers