Commit 220d9b8c authored by Staale Smedseng's avatar Staale Smedseng

This is a backport of the two patches for Bug #28299:

To-number conversion warnings work differenly with CHAR 
and VARCHAR sp variables.

The original revision-IDs are:
  staale.smedseng@sun.com-20081124095339-2qdvzkp0rn1ljs30
  staale.smedseng@sun.com-20081125104611-rtxic5d12e83ag2o
                                                
The patch provides ER_TRUNCATED_WRONG_VALUE warning messages
for conversion of VARCHAR to numberic values, in line with
messages provided for CHAR conversions. Conversions are
checked for success, and the message is emitted in case
failure.
                                                
The tests are amended to accept the added warning messages,
and explicit conversion of ON/OFF values is added for
statements checking system variables. In test
rpl.rpl_switch_stm_row_mixed checking for warnings is
temporarily disabled for one statement, as this generates
warning messages for strings that vary between executions.


sql/field.cc:
  The pushing of the truncation warning is now done in a
  separate static function, and used in various places.
parent 5ca59914
......@@ -382,6 +382,9 @@ y
SELECT b DIV 900 y FROM t1 GROUP BY y;
y
0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'str1'
Warning 1292 Truncated incorrect INTEGER value: 'str2'
SELECT c DIV 900 y FROM t1 GROUP BY y;
y
0
......
......@@ -1151,6 +1151,9 @@ INSERT INTO t2 VALUES (0), (1);
SELECT * FROM t1, t2 WHERE num=str;
str num
notnumber 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
Warning 1292 Truncated incorrect DOUBLE value: 'notnumber'
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
str num
notnumber 0
......
......@@ -298,6 +298,13 @@ id
1
2
3
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
Warning 1292 Truncated incorrect DOUBLE value: 'hello'
select @@profiling;
@@profiling
1
......
......@@ -279,6 +279,9 @@ b char(10) YES NULL
SET @arg00=1;
execute stmt4 using @arg00;
Field Type Null Key Default Extra
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
Warning 1292 Truncated incorrect DOUBLE value: 'b'
prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
execute stmt4;
Field Type Null Key Default Extra
......
......@@ -1158,3 +1158,30 @@ f1() @b
0 abc
drop function f1;
drop table t1;
---------------------------------------------------------------
BUG#28299
---------------------------------------------------------------
CREATE PROCEDURE ctest()
BEGIN
DECLARE i CHAR(16);
DECLARE j INT;
SET i= 'string';
SET j= 1 + i;
END|
CALL ctest();
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'string '
DROP PROCEDURE ctest;
CREATE PROCEDURE vctest()
BEGIN
DECLARE i VARCHAR(16);
DECLARE j INT;
SET i= 'string';
SET j= 1 + i;
END|
CALL vctest();
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'string'
DROP PROCEDURE vctest;
......@@ -489,3 +489,23 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1a'
Warning 1292 Truncated incorrect INTEGER value: 't'
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
SELECT 5 = a FROM t1;
5 = a
1
0
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's'
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
SELECT 5 = a FROM t1;
5 = a
1
0
0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 's '
DROP TABLE t1;
......@@ -22843,6 +22843,9 @@ SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
ABC 1.73205080756888
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT SQRT('DEF');
SQRT('DEF')
0
......@@ -22863,7 +22866,12 @@ SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
ABC 1.73205080756888
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......@@ -22871,6 +22879,8 @@ f1 ABC
my_sqrt 1.73205080756888
DROP TABLE t2;
CREATE TABLE t2 AS SELECT * FROM v1;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......@@ -22878,6 +22888,8 @@ f1 ABC
my_sqrt 1.73205080756888
DROP TABLE t2;
CREATE TABLE t2 AS SELECT * FROM v2;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......
......@@ -22845,6 +22845,9 @@ SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
ABC 1.73205080756888
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT SQRT('DEF');
SQRT('DEF')
0
......@@ -22865,7 +22868,12 @@ SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
ABC 1.73205080756888
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......@@ -22873,6 +22881,8 @@ f1 ABC
my_sqrt 1.73205080756888
DROP TABLE t2;
CREATE TABLE t2 AS SELECT * FROM v1;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......@@ -22880,6 +22890,8 @@ f1 ABC
my_sqrt 1.73205080756888
DROP TABLE t2;
CREATE TABLE t2 AS SELECT * FROM v2;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......
......@@ -22843,6 +22843,10 @@ SELECT * FROM v1 order by 2;
f1 my_sqrt
ABC 0
ABC 1.73205080756888
+ Warnings:
+ Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
+ Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT SQRT('DEF');
SQRT('DEF')
0
......@@ -22863,7 +22867,12 @@ SELECT * FROM v2 order by 2;
f1 my_sqrt
ABC 0
ABC 1.73205080756888
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
CREATE TABLE t2 AS SELECT f1, SQRT(f2) my_sqrt FROM t1;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......@@ -22871,6 +22880,8 @@ f1 ABC
my_sqrt 1.73205080756888
DROP TABLE t2;
CREATE TABLE t2 AS SELECT * FROM v1;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......@@ -22878,6 +22889,8 @@ f1 ABC
my_sqrt 1.73205080756888
DROP TABLE t2;
CREATE TABLE t2 AS SELECT * FROM v2;
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'DEF'
SELECT * FROM t2 order by 2;
f1 ABC
my_sqrt 0
......
......@@ -145,7 +145,9 @@ create table t3 select 1 union select UUID();
create table t4 select * from t1 where 3 in (select 1 union select 2 union select UUID() union select 3);
create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3);
# what if UUID() is first:
--disable_warnings
insert into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4);
--enable_warnings
# inside a stored procedure
......
......@@ -54,19 +54,19 @@ ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with
SELECT @@global.autocommit;
ERROR HY000: Variable 'autocommit' is a SESSION variable
'#----------------------FN_DYNVARS_003_06------------------------#'
SELECT @@session.autocommit = VARIABLE_VALUE
SELECT IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='autocommit';
@@session.autocommit = VARIABLE_VALUE
0
IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE
1
Bug # 34839: Values in variable and information_schema do not match for autocommit
'#----------------------FN_DYNVARS_003_07------------------------#'
SET @@autocommit = 1;
SELECT @@autocommit = VARIABLE_VALUE
SELECT IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='autocommit';
@@autocommit = VARIABLE_VALUE
0
IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_003_08-------------------------#'
SET @@autocommit = OFF;
SELECT @@autocommit;
......
......@@ -53,11 +53,11 @@ ERROR HY000: Variable 'automatic_sp_privileges' is a GLOBAL variable and should
SELECT @@session.automatic_sp_privileges;
ERROR HY000: Variable 'automatic_sp_privileges' is a GLOBAL variable
'#----------------------FN_DYNVARS_004_06------------------------#'
SELECT @@global.automatic_sp_privileges = VARIABLE_VALUE
SELECT IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='automatic_sp_privileges';
@@global.automatic_sp_privileges = VARIABLE_VALUE
0
IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE
1
'Bug# 34839: Values in variable and information_schema donot match'
'#---------------------FN_DYNVARS_004_07----------------------#'
SET @@global.automatic_sp_privileges = OFF;
......
......@@ -49,11 +49,11 @@ ERROR HY000: Variable 'big_tables' is a SESSION variable and can't be used with
SELECT @@global.big_tables;
ERROR HY000: Variable 'big_tables' is a SESSION variable
'#----------------------FN_DYNVARS_005_05------------------------#'
SELECT @@big_tables = VARIABLE_VALUE
SELECT IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='big_tables';
@@big_tables = VARIABLE_VALUE
0
IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE
1
Bug # 34839: Values in variable and information_schema do not match for autocommit
'#---------------------FN_DYNVARS_005_06----------------------#'
SET @@big_tables = OFF;
......
......@@ -103,10 +103,10 @@ SELECT @@session.engine_condition_pushdown AS res_is_1;
res_is_1
1
'#----------------------FN_DYNVARS_028_06------------------------#'
SELECT @@global.engine_condition_pushdown = VARIABLE_VALUE
SELECT IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='engine_condition_pushdown';
@@global.engine_condition_pushdown = VARIABLE_VALUE
IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@global.engine_condition_pushdown;
@@global.engine_condition_pushdown
......@@ -117,11 +117,11 @@ WHERE VARIABLE_NAME='engine_condition_pushdown';
VARIABLE_VALUE
OFF
'#----------------------FN_DYNVARS_028_07------------------------#'
SELECT @@session.engine_condition_pushdown = VARIABLE_VALUE
SELECT IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='engine_condition_pushdown';
@@session.engine_condition_pushdown = VARIABLE_VALUE
0
IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.engine_condition_pushdown;
@@session.engine_condition_pushdown
1
......
......@@ -63,11 +63,11 @@ ERROR HY000: Variable 'flush' is a GLOBAL variable and should be set with SET GL
SELECT @@session.flush;
ERROR HY000: Variable 'flush' is a GLOBAL variable
'#----------------------FN_DYNVARS_030_06------------------------#'
SELECT @@global.flush = VARIABLE_VALUE
SELECT IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='flush';
@@global.flush = VARIABLE_VALUE
0
IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_030_07----------------------#'
SET @@global.flush = TRUE;
SELECT @@global.flush;
......
......@@ -65,10 +65,10 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_032_07------------------------#'
SELECT @@session.foreign_key_checks = VARIABLE_VALUE
SELECT IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='foreign_key_checks';
@@session.foreign_key_checks = VARIABLE_VALUE
IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.foreign_key_checks;
@@session.foreign_key_checks
......
......@@ -47,10 +47,10 @@ ERROR HY000: Variable 'general_log' is a GLOBAL variable and should be set with
SELECT @@session.general_log;
ERROR HY000: Variable 'general_log' is a GLOBAL variable
'#----------------------FN_DYNVARS_004_05------------------------#'
SELECT @@global.general_log = VARIABLE_VALUE
SELECT IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='general_log';
@@global.general_log = VARIABLE_VALUE
IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_004_06----------------------#'
SET @@global.general_log = 0;
......
......@@ -12,11 +12,11 @@ COUNT(@@GLOBAL.innodb_checksums)
1
1 Expected
'#---------------------BS_STVARS_023_03----------------------#'
SELECT @@GLOBAL.innodb_checksums = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_checksums';
@@GLOBAL.innodb_checksums = VARIABLE_VALUE
0
IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_checksums);
COUNT(@@GLOBAL.innodb_checksums)
......
......@@ -12,11 +12,11 @@ COUNT(@@GLOBAL.innodb_doublewrite)
1
1 Expected
'#---------------------BS_STVARS_026_03----------------------#'
SELECT @@GLOBAL.innodb_doublewrite = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_doublewrite';
@@GLOBAL.innodb_doublewrite = VARIABLE_VALUE
0
IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_doublewrite);
COUNT(@@GLOBAL.innodb_doublewrite)
......
......@@ -12,10 +12,10 @@ COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog)
1
1 Expected
'#---------------------BS_STVARS_031_03----------------------#'
SELECT @@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog';
@@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE
IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
......
......@@ -12,10 +12,10 @@ COUNT(@@GLOBAL.innodb_rollback_on_timeout)
1
1 Expected
'#---------------------BS_STVARS_039_03----------------------#'
SELECT @@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_rollback_on_timeout';
@@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE
IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout);
......
......@@ -105,10 +105,10 @@ SELECT @@session.innodb_support_xa AS res_is_1;
res_is_1
1
'#----------------------FN_DYNVARS_046_06------------------------#'
SELECT @@global.innodb_support_xa =
SELECT IF(@@global.innodb_support_xa, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_support_xa';
@@global.innodb_support_xa =
IF(@@global.innodb_support_xa, "ON", "OFF") =
VARIABLE_VALUE
1
SELECT @@global.innodb_support_xa;
......@@ -119,12 +119,12 @@ WHERE VARIABLE_NAME='innodb_support_xa';
VARIABLE_VALUE
OFF
'#----------------------FN_DYNVARS_046_07------------------------#'
SELECT @@session.innodb_support_xa =
SELECT IF(@@session.innodb_support_xa, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='innodb_support_xa';
@@session.innodb_support_xa =
IF(@@session.innodb_support_xa, "ON", "OFF") =
VARIABLE_VALUE
0
1
SELECT @@session.innodb_support_xa;
@@session.innodb_support_xa
1
......
......@@ -99,10 +99,10 @@ SELECT @@session.innodb_table_locks AS res_is_1;
res_is_1
1
'#----------------------FN_DYNVARS_046_06------------------------#'
SELECT @@global.innodb_table_locks =
SELECT IF(@@global.innodb_table_locks, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_table_locks';
@@global.innodb_table_locks =
IF(@@global.innodb_table_locks, "ON", "OFF") =
VARIABLE_VALUE
1
SELECT @@global.innodb_table_locks;
......@@ -113,12 +113,12 @@ WHERE VARIABLE_NAME='innodb_table_locks';
VARIABLE_VALUE
OFF
'#----------------------FN_DYNVARS_046_07------------------------#'
SELECT @@session.innodb_table_locks =
SELECT IF(@@session.innodb_table_locks, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='innodb_table_locks';
@@session.innodb_table_locks =
IF(@@session.innodb_table_locks, "ON", "OFF") =
VARIABLE_VALUE
0
1
SELECT @@session.innodb_table_locks;
@@session.innodb_table_locks
1
......
......@@ -120,16 +120,16 @@ SELECT @@session.keep_files_on_create;
@@session.keep_files_on_create
0
'#------------------FN_DYNVARS_054_06-----------------------#'
SELECT @@global.keep_files_on_create = VARIABLE_VALUE
SELECT IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='keep_files_on_create';
@@global.keep_files_on_create = VARIABLE_VALUE
IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_054_07-----------------------#'
SELECT @@session.keep_files_on_create = VARIABLE_VALUE
SELECT IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='keep_files_on_create';
@@session.keep_files_on_create = VARIABLE_VALUE
IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_001_08----------------------#'
SET @@keep_files_on_create = OFF;
......
......@@ -53,11 +53,11 @@ ERROR HY000: Variable 'local_infile' is a GLOBAL variable and should be set with
SELECT @@session.local_infile = 1;
ERROR HY000: Variable 'local_infile' is a GLOBAL variable
'#----------------------FN_DYNVARS_018_06------------------------#'
SELECT @@global.local_infile = VARIABLE_VALUE
SELECT IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='local_infile';
@@global.local_infile = VARIABLE_VALUE
0
IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_018_07----------------------#'
SET @@global.local_infile = OFF;
SELECT @@global.local_infile;
......
......@@ -69,12 +69,12 @@ ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the valu
SET @@global.log_bin_trust_function_creators = test;
ERROR 42000: Variable 'log_bin_trust_function_creators' can't be set to the value of 'test'
'#------------------FN_DYNVARS_063_06-----------------------#'
SELECT @@global.log_bin_trust_function_creators = VARIABLE_VALUE
SELECT IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='log_bin_trust_function_creators';
@@global.log_bin_trust_function_creators = VARIABLE_VALUE
IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.log_bin_trust_function_creators = VARIABLE_VALUE
SELECT IF(@@session.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='log_bin_trust_function_creators';
ERROR HY000: Variable 'log_bin_trust_function_creators' is a GLOBAL variable
......
......@@ -102,3 +102,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SET @@SESSION log_queries_not_using_indexes= TRUE;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'log_queries_not_using_indexes= TRUE' at line 1
SET @@global.log_queries_not_using_indexes= @start_value;
SELECT IF(@@GLOBAL.log_queries_not_using_indexes, "ON", "OFF") = VARIABLE_VALUE
IF(@@GLOBAL.log_queries_not_using_indexes, "ON", "OFF") = VARIABLE_VALUE
1
......@@ -118,16 +118,16 @@ ERROR 42000: Variable 'low_priority_updates' can't be set to the value of '65550
SET @@session.low_priority_updates = test;
ERROR 42000: Variable 'low_priority_updates' can't be set to the value of 'test'
'#------------------FN_DYNVARS_069_06-----------------------#'
SELECT @@global.low_priority_updates = VARIABLE_VALUE
SELECT IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='low_priority_updates';
@@global.low_priority_updates = VARIABLE_VALUE
IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_069_07-----------------------#'
SELECT @@session.low_priority_updates = VARIABLE_VALUE
SELECT IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='low_priority_updates';
@@session.low_priority_updates = VARIABLE_VALUE
IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_069_08----------------------#'
SET @@low_priority_updates = FALSE;
......
......@@ -11,10 +11,10 @@ COUNT(@@GLOBAL.myisam_use_mmap)
1
1 Expected
'#---------------------BS_STVARS_042_03----------------------#'
SELECT @@GLOBAL.myisam_use_mmap = VARIABLE_VALUE
SELECT IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='myisam_use_mmap';
@@GLOBAL.myisam_use_mmap = VARIABLE_VALUE
IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@GLOBAL.myisam_use_mmap);
......
......@@ -117,16 +117,16 @@ ERROR 42000: Variable 'new' can't be set to the value of '65550'
SET @@session.new = test;
ERROR 42000: Variable 'new' can't be set to the value of 'test'
'#------------------FN_DYNVARS_113_06-----------------------#'
SELECT @@global.new = VARIABLE_VALUE
SELECT IF(@@global.new, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='new';
@@global.new = VARIABLE_VALUE
IF(@@global.new, "ON", "OFF") = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_113_07-----------------------#'
SELECT @@session.new = VARIABLE_VALUE
SELECT IF(@@session.new, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='new';
@@session.new = VARIABLE_VALUE
IF(@@session.new, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_113_08----------------------#'
SET @@new = OFF;
......
......@@ -113,16 +113,16 @@ ERROR 42000: Variable 'old_passwords' can't be set to the value of '65550'
SET @@session.old_passwords = test;
ERROR 42000: Variable 'old_passwords' can't be set to the value of 'test'
'#------------------FN_DYNVARS_114_06-----------------------#'
SELECT @@global.old_passwords = VARIABLE_VALUE
SELECT IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='old_passwords';
@@global.old_passwords = VARIABLE_VALUE
IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_114_07-----------------------#'
SELECT @@session.old_passwords = VARIABLE_VALUE
SELECT IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='old_passwords';
@@session.old_passwords = VARIABLE_VALUE
IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_114_08----------------------#'
SET @@old_passwords = OFF;
......
......@@ -103,10 +103,10 @@ SELECT @@session.query_cache_wlock_invalidate AS res_is_1;
res_is_1
1
'#----------------------FN_DYNVARS_135_06------------------------#'
SELECT @@global.query_cache_wlock_invalidate = VARIABLE_VALUE
SELECT IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
@@global.query_cache_wlock_invalidate = VARIABLE_VALUE
IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@global.query_cache_wlock_invalidate;
@@global.query_cache_wlock_invalidate
......@@ -117,11 +117,11 @@ WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
VARIABLE_VALUE
OFF
'#----------------------FN_DYNVARS_135_07------------------------#'
SELECT @@session.query_cache_wlock_invalidate = VARIABLE_VALUE
SELECT IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
@@session.query_cache_wlock_invalidate = VARIABLE_VALUE
0
IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.query_cache_wlock_invalidate;
@@session.query_cache_wlock_invalidate
1
......
......@@ -82,15 +82,15 @@ SELECT @@read_only;
@@read_only
0
'#----------------------FN_DYNVARS_139_06------------------------#'
SELECT @@global.read_only = VARIABLE_VALUE
SELECT IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='read_only';
@@global.read_only = VARIABLE_VALUE
IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@read_only = VARIABLE_VALUE
SELECT IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='read_only';
@@read_only = VARIABLE_VALUE
IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_139_07----------------------#'
SET @@global.read_only = 1;
......
......@@ -69,10 +69,10 @@ ERROR HY000: Variable 'relay_log_purge' is a GLOBAL variable and should be set w
SELECT @@session.relay_log_purge;
ERROR HY000: Variable 'relay_log_purge' is a GLOBAL variable
'#----------------------FN_DYNVARS_141_06------------------------#'
SELECT @@global.relay_log_purge = VARIABLE_VALUE
SELECT IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='relay_log_purge';
@@global.relay_log_purge = VARIABLE_VALUE
IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_141_07----------------------#'
SET @@global.relay_log_purge = 1;
......
......@@ -68,11 +68,11 @@ WHERE VARIABLE_NAME='secure_auth';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_143_07------------------------#'
SELECT @@global.secure_auth = VARIABLE_VALUE
SELECT IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='secure_auth';
@@global.secure_auth = VARIABLE_VALUE
0
IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@global.secure_auth;
@@global.secure_auth
1
......
......@@ -8,5 +8,8 @@ ERROR HY000: Unknown system variable 'slave_allow_batching'
'#-------------------FN_DYNVARS_145_05----------------------------#'
'#----------------------FN_DYNVARS_145_06------------------------#'
'#----------------------FN_DYNVARS_145_07------------------------#'
SELECT IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_145_08-------------------------#'
'#---------------------FN_DYNVARS_145_09----------------------#'
......@@ -66,11 +66,11 @@ WHERE VARIABLE_NAME='slave_compressed_protocol';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_147_07------------------------#'
SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE
SELECT IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slave_compressed_protocol';
@@global.slave_compressed_protocol = VARIABLE_VALUE
0
IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@global.slave_compressed_protocol;
@@global.slave_compressed_protocol
1
......
......@@ -47,10 +47,10 @@ ERROR HY000: Variable 'slow_query_log' is a GLOBAL variable and should be set wi
SELECT @@session.slow_query_log;
ERROR HY000: Variable 'slow_query_log' is a GLOBAL variable
'#----------------------FN_DYNVARS_004_05------------------------#'
SELECT @@global.slow_query_log = VARIABLE_VALUE
SELECT IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slow_query_log';
@@global.slow_query_log = VARIABLE_VALUE
IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_004_06----------------------#'
SET @@global.slow_query_log = 0;
......
......@@ -12,11 +12,11 @@ COUNT(@@SESSION.sql_auto_is_null)
1
1 Expected
'#---------------------BS_STVARS_044_03----------------------#'
SELECT @@SESSION.sql_auto_is_null = VARIABLE_VALUE
SELECT IF(@@SESSION.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_auto_is_null';
@@SESSION.sql_auto_is_null = VARIABLE_VALUE
0
IF(@@SESSION.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE
1
1 Expected
SELECT COUNT(@@SESSION.sql_auto_is_null);
COUNT(@@SESSION.sql_auto_is_null)
......
......@@ -66,10 +66,10 @@ WHERE VARIABLE_NAME='sql_big_selects';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_153_07------------------------#'
SELECT @@session.sql_big_selects = VARIABLE_VALUE
SELECT IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_big_selects';
@@session.sql_big_selects = VARIABLE_VALUE
IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_big_selects;
@@session.sql_big_selects
......
......@@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_big_tables';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_154_07------------------------#'
SELECT @@session.sql_big_tables = VARIABLE_VALUE
SELECT IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_big_tables';
@@session.sql_big_tables = VARIABLE_VALUE
IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_big_tables;
@@session.sql_big_tables
......
......@@ -79,10 +79,10 @@ WHERE VARIABLE_NAME='sql_buffer_result';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_155_07------------------------#'
SELECT @@session.sql_buffer_result = VARIABLE_VALUE
SELECT IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_buffer_result';
@@session.sql_buffer_result = VARIABLE_VALUE
IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_buffer_result;
@@session.sql_buffer_result
......
......@@ -69,10 +69,10 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_156_07------------------------#'
SELECT @@session.sql_log_bin = VARIABLE_VALUE
SELECT IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_log_bin';
@@session.sql_log_bin = VARIABLE_VALUE
IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_log_bin;
@@session.sql_log_bin
......
......@@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_log_off';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_157_07------------------------#'
SELECT @@session.sql_log_off = VARIABLE_VALUE
SELECT IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_log_off';
@@session.sql_log_off = VARIABLE_VALUE
IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_log_off;
@@session.sql_log_off
......
......@@ -102,10 +102,10 @@ SELECT @@session.sql_low_priority_updates AS res_is_1;
res_is_1
1
'#----------------------FN_DYNVARS_159_06------------------------#'
SELECT @@global.sql_low_priority_updates = VARIABLE_VALUE
SELECT IF(@@global.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='sql_low_priority_updates';
@@global.sql_low_priority_updates = VARIABLE_VALUE
IF(@@global.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@global.sql_low_priority_updates;
@@global.sql_low_priority_updates
......@@ -116,11 +116,11 @@ WHERE VARIABLE_NAME='sql_low_priority_updates';
VARIABLE_VALUE
OFF
'#----------------------FN_DYNVARS_159_07------------------------#'
SELECT @@session.sql_low_priority_updates = VARIABLE_VALUE
SELECT IF(@@session.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_low_priority_updates';
@@session.sql_low_priority_updates = VARIABLE_VALUE
0
IF(@@session.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_low_priority_updates;
@@session.sql_low_priority_updates
1
......
......@@ -69,10 +69,10 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_161_07------------------------#'
SELECT @@session.sql_notes = VARIABLE_VALUE
SELECT IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_notes';
@@session.sql_notes = VARIABLE_VALUE
IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_notes;
@@session.sql_notes
......
......@@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_quote_show_create';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_162_07------------------------#'
SELECT @@session.sql_quote_show_create = VARIABLE_VALUE
SELECT IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_quote_show_create';
@@session.sql_quote_show_create = VARIABLE_VALUE
IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_quote_show_create;
@@session.sql_quote_show_create
......
......@@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_safe_updates';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_163_07------------------------#'
SELECT @@session.sql_safe_updates = VARIABLE_VALUE
SELECT IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_safe_updates';
@@session.sql_safe_updates = VARIABLE_VALUE
IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_safe_updates;
@@session.sql_safe_updates
......
......@@ -71,10 +71,10 @@ WHERE VARIABLE_NAME='sql_warnings';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_166_07------------------------#'
SELECT @@session.sql_warnings = VARIABLE_VALUE
SELECT IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_warnings';
@@session.sql_warnings = VARIABLE_VALUE
IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@session.sql_warnings;
@@session.sql_warnings
......
......@@ -69,10 +69,10 @@ ERROR HY000: Variable 'sync_frm' is a GLOBAL variable and should be set with SET
SELECT @@session.sync_frm;
ERROR HY000: Variable 'sync_frm' is a GLOBAL variable
'#----------------------FN_DYNVARS_169_06------------------------#'
SELECT @@global.sync_frm = VARIABLE_VALUE
SELECT IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='sync_frm';
@@global.sync_frm = VARIABLE_VALUE
IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_169_07----------------------#'
SET @@global.sync_frm = 1;
......
......@@ -67,11 +67,11 @@ WHERE VARIABLE_NAME='timed_mutexes';
count(VARIABLE_VALUE)
1
'#----------------------FN_DYNVARS_177_07------------------------#'
SELECT @@global.timed_mutexes = VARIABLE_VALUE
SELECT IF(@@global.timed_mutexes, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='timed_mutexes';
@@global.timed_mutexes = VARIABLE_VALUE
0
IF(@@global.timed_mutexes, "ON", "OFF") = VARIABLE_VALUE
1
SELECT @@global.timed_mutexes;
@@global.timed_mutexes
1
......
......@@ -58,10 +58,10 @@ ERROR 42000: Variable 'unique_checks' can't be set to the value of 'test'
SET @@session.unique_checks = 123456789031;
ERROR 42000: Variable 'unique_checks' can't be set to the value of '123456789031'
'#------------------FN_DYNVARS_005_07-----------------------#'
SELECT @@session.unique_checks = VARIABLE_VALUE
SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='unique_checks';
@@session.unique_checks = VARIABLE_VALUE
IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_001_08----------------------#'
SET @@unique_checks = 1;
......
......@@ -113,7 +113,7 @@ SELECT @@global.autocommit;
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT @@session.autocommit = VARIABLE_VALUE
SELECT IF(@@session.autocommit, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='autocommit';
--echo Bug # 34839: Values in variable and information_schema do not match for autocommit
......@@ -124,7 +124,7 @@ WHERE VARIABLE_NAME='autocommit';
#########################################################################
SET @@autocommit = 1;
SELECT @@autocommit = VARIABLE_VALUE
SELECT IF(@@autocommit, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='autocommit';
......
......@@ -113,7 +113,7 @@ SELECT @@session.automatic_sp_privileges;
# Check if the value in GLOBAL Tables matches values in variable #
##############################################################################
SELECT @@global.automatic_sp_privileges = VARIABLE_VALUE
SELECT IF(@@global.automatic_sp_privileges, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='automatic_sp_privileges';
echo 'Bug# 34839: Values in variable and information_schema donot match';
......
......@@ -107,7 +107,7 @@ SELECT @@global.big_tables;
# Check if the value in SESSION Tables matches values in variable #
##############################################################################
SELECT @@big_tables = VARIABLE_VALUE
SELECT IF(@@big_tables, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='big_tables';
--echo Bug # 34839: Values in variable and information_schema do not match for autocommit
......
......@@ -160,7 +160,7 @@ SELECT @@session.engine_condition_pushdown AS res_is_1;
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.engine_condition_pushdown = VARIABLE_VALUE
SELECT IF(@@global.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='engine_condition_pushdown';
SELECT @@global.engine_condition_pushdown;
......@@ -173,7 +173,7 @@ WHERE VARIABLE_NAME='engine_condition_pushdown';
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT @@session.engine_condition_pushdown = VARIABLE_VALUE
SELECT IF(@@session.engine_condition_pushdown, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='engine_condition_pushdown';
SELECT @@session.engine_condition_pushdown;
......
......@@ -120,7 +120,7 @@ SELECT @@session.flush;
# Check if the value in GLOBAL Tables matches values in variable #
####################################################################
SELECT @@global.flush = VARIABLE_VALUE
SELECT IF(@@global.flush, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='flush';
......
......@@ -131,7 +131,7 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.foreign_key_checks = VARIABLE_VALUE
SELECT IF(@@session.foreign_key_checks, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='foreign_key_checks';
SELECT @@session.foreign_key_checks;
......
......@@ -103,7 +103,7 @@ SELECT @@session.general_log;
# Check if the value in GLOBAL Tables matches values in variable #
##############################################################################
SELECT @@global.general_log = VARIABLE_VALUE
SELECT IF(@@global.general_log, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='general_log';
......
......@@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_checksums);
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.innodb_checksums = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_checksums, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_checksums';
--echo 1 Expected
......
......@@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_doublewrite);
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.innodb_doublewrite = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_doublewrite, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_doublewrite';
--echo 1 Expected
......
......@@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_locks_unsafe_for_binlog);
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.innodb_locks_unsafe_for_binlog = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_locks_unsafe_for_binlog, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_locks_unsafe_for_binlog';
--echo 1 Expected
......
......@@ -52,7 +52,7 @@ SELECT COUNT(@@GLOBAL.innodb_rollback_on_timeout);
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.innodb_rollback_on_timeout = VARIABLE_VALUE
SELECT IF(@@GLOBAL.innodb_rollback_on_timeout, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_rollback_on_timeout';
--echo 1 Expected
......
......@@ -169,7 +169,7 @@ SELECT @@session.innodb_support_xa AS res_is_1;
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.innodb_support_xa =
SELECT IF(@@global.innodb_support_xa, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_support_xa';
SELECT @@global.innodb_support_xa;
......@@ -182,7 +182,7 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT @@session.innodb_support_xa =
SELECT IF(@@session.innodb_support_xa, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='innodb_support_xa';
SELECT @@session.innodb_support_xa;
......
......@@ -167,7 +167,7 @@ SELECT @@session.innodb_table_locks AS res_is_1;
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.innodb_table_locks =
SELECT IF(@@global.innodb_table_locks, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_table_locks';
SELECT @@global.innodb_table_locks;
......@@ -179,7 +179,7 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT @@session.innodb_table_locks =
SELECT IF(@@session.innodb_table_locks, "ON", "OFF") =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='innodb_table_locks';
SELECT @@session.innodb_table_locks;
......
......@@ -156,7 +156,7 @@ SELECT @@session.keep_files_on_create;
####################################################################
SELECT @@global.keep_files_on_create = VARIABLE_VALUE
SELECT IF(@@global.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='keep_files_on_create';
......@@ -165,7 +165,7 @@ WHERE VARIABLE_NAME='keep_files_on_create';
# Check if the value in SESSION Table matches value in variable #
####################################################################
SELECT @@session.keep_files_on_create = VARIABLE_VALUE
SELECT IF(@@session.keep_files_on_create, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='keep_files_on_create';
......
......@@ -112,7 +112,7 @@ SELECT @@session.local_infile = 1;
# Check if the value in GLOBAL Tables matches values in variable #
####################################################################
SELECT @@global.local_infile = VARIABLE_VALUE
SELECT IF(@@global.local_infile, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='local_infile';
......
......@@ -122,12 +122,12 @@ SET @@global.log_bin_trust_function_creators = test;
###############################################################################
SELECT @@global.log_bin_trust_function_creators = VARIABLE_VALUE
SELECT IF(@@global.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='log_bin_trust_function_creators';
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.log_bin_trust_function_creators = VARIABLE_VALUE
SELECT IF(@@session.log_bin_trust_function_creators, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='log_bin_trust_function_creators';
......
......@@ -129,4 +129,5 @@ SET @@SESSION log_queries_not_using_indexes= TRUE;
SET @@global.log_queries_not_using_indexes= @start_value;
SELECT IF(@@GLOBAL.log_queries_not_using_indexes, "ON", "OFF") = VARIABLE_VALUE
......@@ -156,7 +156,7 @@ SET @@session.low_priority_updates = test;
####################################################################
SELECT @@global.low_priority_updates = VARIABLE_VALUE
SELECT IF(@@global.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='low_priority_updates';
......@@ -165,7 +165,7 @@ WHERE VARIABLE_NAME='low_priority_updates';
# Check if the value in SESSION Table matches value in variable #
####################################################################
SELECT @@session.low_priority_updates = VARIABLE_VALUE
SELECT IF(@@session.low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='low_priority_updates';
......
......@@ -54,7 +54,7 @@ SELECT COUNT(@@GLOBAL.myisam_use_mmap);
# Check if the value in GLOBAL Table matches value in variable #
#################################################################
SELECT @@GLOBAL.myisam_use_mmap = VARIABLE_VALUE
SELECT IF(@@GLOBAL.myisam_use_mmap, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='myisam_use_mmap';
--echo 1 Expected
......
......@@ -154,7 +154,7 @@ SET @@session.new = test;
####################################################################
SELECT @@global.new = VARIABLE_VALUE
SELECT IF(@@global.new, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='new';
......@@ -163,7 +163,7 @@ WHERE VARIABLE_NAME='new';
# Check if the value in SESSION Table matches value in variable #
####################################################################
SELECT @@session.new = VARIABLE_VALUE
SELECT IF(@@session.new, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='new';
......
......@@ -154,7 +154,7 @@ SET @@session.old_passwords = test;
####################################################################
SELECT @@global.old_passwords = VARIABLE_VALUE
SELECT IF(@@global.old_passwords, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='old_passwords';
......@@ -163,7 +163,7 @@ WHERE VARIABLE_NAME='old_passwords';
# Check if the value in SESSION Table matches value in variable #
####################################################################
SELECT @@session.old_passwords = VARIABLE_VALUE
SELECT IF(@@session.old_passwords, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='old_passwords';
......
......@@ -165,7 +165,7 @@ SELECT @@session.query_cache_wlock_invalidate AS res_is_1;
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.query_cache_wlock_invalidate = VARIABLE_VALUE
SELECT IF(@@global.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
SELECT @@global.query_cache_wlock_invalidate;
......@@ -178,7 +178,7 @@ WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT @@session.query_cache_wlock_invalidate = VARIABLE_VALUE
SELECT IF(@@session.query_cache_wlock_invalidate, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='query_cache_wlock_invalidate';
SELECT @@session.query_cache_wlock_invalidate;
......
......@@ -121,11 +121,11 @@ SELECT @@read_only;
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
##############################################################################
SELECT @@global.read_only = VARIABLE_VALUE
SELECT IF(@@global.read_only, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='read_only';
SELECT @@read_only = VARIABLE_VALUE
SELECT IF(@@read_only, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='read_only';
......
......@@ -123,7 +123,7 @@ SELECT @@session.relay_log_purge;
# Check if the value in GLOBAL Tables matches values in variable #
#####################################################################
SELECT @@global.relay_log_purge = VARIABLE_VALUE
SELECT IF(@@global.relay_log_purge, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='relay_log_purge';
......
......@@ -130,7 +130,7 @@ WHERE VARIABLE_NAME='secure_auth';
# Check if the value in GLOBAL Table matches value in variable #
########################################################################
SELECT @@global.secure_auth = VARIABLE_VALUE
SELECT IF(@@global.secure_auth, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='secure_auth';
SELECT @@global.secure_auth;
......
......@@ -130,7 +130,7 @@ SET @global_start_value = @@global.slave_allow_batching;
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
#SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
#SELECT IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
#SELECT @@global.slave_allow_batching;
#SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
#--echo 'Bug: value in information schema does not match'
......
......@@ -127,7 +127,7 @@ WHERE VARIABLE_NAME='slave_compressed_protocol';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.slave_compressed_protocol = VARIABLE_VALUE
SELECT IF(@@global.slave_compressed_protocol, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slave_compressed_protocol';
SELECT @@global.slave_compressed_protocol;
......
......@@ -104,7 +104,7 @@ SELECT @@session.slow_query_log;
# Check if the value in GLOBAL Tables matches values in variable #
##############################################################################
SELECT @@global.slow_query_log = VARIABLE_VALUE
SELECT IF(@@global.slow_query_log, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slow_query_log';
......
......@@ -55,7 +55,7 @@ SELECT COUNT(@@SESSION.sql_auto_is_null);
# Check if the value in SESSION Table matches value in variable #
#################################################################
SELECT @@SESSION.sql_auto_is_null = VARIABLE_VALUE
SELECT IF(@@SESSION.sql_auto_is_null, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_auto_is_null';
--echo 1 Expected
......
......@@ -132,7 +132,7 @@ WHERE VARIABLE_NAME='sql_big_selects';
# Check if the value in GLOBAL Table matches value in variable #
########################################################################
SELECT @@session.sql_big_selects = VARIABLE_VALUE
SELECT IF(@@session.sql_big_selects, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_big_selects';
SELECT @@session.sql_big_selects;
......
......@@ -135,7 +135,7 @@ WHERE VARIABLE_NAME='sql_big_tables';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_big_tables = VARIABLE_VALUE
SELECT IF(@@session.sql_big_tables, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_big_tables';
SELECT @@session.sql_big_tables;
......
......@@ -144,7 +144,7 @@ WHERE VARIABLE_NAME='sql_buffer_result';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_buffer_result = VARIABLE_VALUE
SELECT IF(@@session.sql_buffer_result, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_buffer_result';
SELECT @@session.sql_buffer_result;
......
......@@ -134,7 +134,7 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_log_bin = VARIABLE_VALUE
SELECT IF(@@session.sql_log_bin, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_log_bin';
SELECT @@session.sql_log_bin;
......
......@@ -135,7 +135,7 @@ WHERE VARIABLE_NAME='sql_log_off';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_log_off = VARIABLE_VALUE
SELECT IF(@@session.sql_log_off, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_log_off';
SELECT @@session.sql_log_off;
......
......@@ -166,7 +166,7 @@ SELECT @@session.sql_low_priority_updates AS res_is_1;
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.sql_low_priority_updates = VARIABLE_VALUE
SELECT IF(@@global.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='sql_low_priority_updates';
SELECT @@global.sql_low_priority_updates;
......@@ -179,7 +179,7 @@ WHERE VARIABLE_NAME='sql_low_priority_updates';
# Check if the value in SESSION Table matches value in variable #
#########################################################################
SELECT @@session.sql_low_priority_updates = VARIABLE_VALUE
SELECT IF(@@session.sql_low_priority_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_low_priority_updates';
SELECT @@session.sql_low_priority_updates;
......
......@@ -135,7 +135,7 @@ SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARI
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_notes = VARIABLE_VALUE
SELECT IF(@@session.sql_notes, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_notes';
SELECT @@session.sql_notes;
......
......@@ -136,7 +136,7 @@ WHERE VARIABLE_NAME='sql_quote_show_create';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_quote_show_create = VARIABLE_VALUE
SELECT IF(@@session.sql_quote_show_create, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_quote_show_create';
SELECT @@session.sql_quote_show_create;
......
......@@ -135,7 +135,7 @@ WHERE VARIABLE_NAME='sql_safe_updates';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_safe_updates = VARIABLE_VALUE
SELECT IF(@@session.sql_safe_updates, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_safe_updates';
SELECT @@session.sql_safe_updates;
......
......@@ -140,7 +140,7 @@ WHERE VARIABLE_NAME='sql_warnings';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@session.sql_warnings = VARIABLE_VALUE
SELECT IF(@@session.sql_warnings, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='sql_warnings';
SELECT @@session.sql_warnings;
......
......@@ -121,7 +121,7 @@ SELECT @@session.sync_frm;
# Check if the value in GLOBAL Tables matches values in variable #
####################################################################
SELECT @@global.sync_frm = VARIABLE_VALUE
SELECT IF(@@global.sync_frm, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='sync_frm';
......
......@@ -128,7 +128,7 @@ WHERE VARIABLE_NAME='timed_mutexes';
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
SELECT @@global.timed_mutexes = VARIABLE_VALUE
SELECT IF(@@global.timed_mutexes, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='timed_mutexes';
SELECT @@global.timed_mutexes;
......
......@@ -121,7 +121,7 @@ SET @@session.unique_checks = 123456789031;
# Check if the value in SESSION Table matches value in variable #
####################################################################
SELECT @@session.unique_checks = VARIABLE_VALUE
SELECT IF(@@session.unique_checks, "ON", "OFF") = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='unique_checks';
......
......@@ -1448,3 +1448,42 @@ drop function f1;
drop table t1;
# End of 5.1 tests.
###########################################################################
#
# Test case for BUG#28299: To-number conversion warnings work
# differenly with CHAR and VARCHAR sp variables
#
###########################################################################
--echo
--echo ---------------------------------------------------------------
--echo BUG#28299
--echo ---------------------------------------------------------------
--echo
DELIMITER |;
CREATE PROCEDURE ctest()
BEGIN
DECLARE i CHAR(16);
DECLARE j INT;
SET i= 'string';
SET j= 1 + i;
END|
DELIMITER ;|
CALL ctest();
DROP PROCEDURE ctest;
DELIMITER |;
CREATE PROCEDURE vctest()
BEGIN
DECLARE i VARCHAR(16);
DECLARE j INT;
SET i= 'string';
SET j= 1 + i;
END|
DELIMITER ;|
CALL vctest();
DROP PROCEDURE vctest;
......@@ -199,3 +199,21 @@ SELECT a,(a + 0) FROM t1 ORDER BY a;
SELECT a,(a DIV 2) FROM t1 ORDER BY a;
SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
DROP TABLE t1;
#
# Bug #28299: To-number conversion warnings work differenly with CHAR
# and VARCHAR sp variables
#
# * Verify that 'Truncated incorrect DOUBLE value' is shown for 's'
# when using both CHAR and VARCHAR.
#
CREATE TABLE t1 (a VARCHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
SELECT 5 = a FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR(16));
INSERT INTO t1 VALUES ('5'), ('s'), ('');
SELECT 5 = a FROM t1;
DROP TABLE t1;
......@@ -1016,6 +1016,36 @@ Item_result Field::result_merge_type(enum_field_types field_type)
Static help functions
*****************************************************************************/
/**
Output a warning for erroneous conversion of strings to numerical
values. For use with ER_TRUNCATED_WRONG_VALUE[_FOR_FIELD]
@param thd THD object
@param str pointer to string that failed to be converted
@param length length of string
@param cs charset for string
@param typestr string describing type converted to
@param error error value to output
@param field_name (for *_FOR_FIELD) name of field
@param row_num (for *_FOR_FIELD) row number
*/
static void push_numerical_conversion_warning(THD* thd, const char* str,
uint length, CHARSET_INFO* cs,
const char* typestr, int error,
const char* field_name="UNKNOWN",
ulong row_num=0)
{
char buf[max(max(DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE,
LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE),
DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE)];
String tmp(buf, sizeof(buf), cs);
tmp.copy(str, length, cs);
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
error, ER(error), typestr, tmp.c_ptr(),
field_name, row_num);
}
/**
Check whether a field type can be partially indexed by a key.
......@@ -1109,14 +1139,11 @@ int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
/* Test if we get an empty string or wrong integer */
if (str == int_end || error == MY_ERRNO_EDOM)
{
char buff[128];
String tmp(buff, (uint32) sizeof(buff), system_charset_info);
tmp.copy(str, length, system_charset_info);
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"integer", tmp.c_ptr(), field_name,
(ulong) table->in_use->warning_info->current_row_for_warning());
push_numerical_conversion_warning(table->in_use, str, length,
cs, "integer",
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
field_name,
table->in_use->warning_info->current_row_for_warning());
return 1;
}
/* Test if we have garbage at the end of the given string. */
......@@ -2674,16 +2701,11 @@ int Field_new_decimal::store(const char *from, uint length,
&decimal_value)) &&
table->in_use->abort_on_warning)
{
/* Because "from" is not NUL-terminated and we use %s in the ER() */
String from_as_str;
from_as_str.copy(from, length, &my_charset_bin);
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", from_as_str.c_ptr(), field_name,
(ulong) table->in_use->warning_info->current_row_for_warning());
push_numerical_conversion_warning(table->in_use, from, length,
&my_charset_bin, "decimal",
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
field_name,
table->in_use->warning_info->current_row_for_warning());
DBUG_RETURN(err);
}
......@@ -2697,18 +2719,13 @@ int Field_new_decimal::store(const char *from, uint length,
break;
case E_DEC_BAD_NUM:
{
/* Because "from" is not NUL-terminated and we use %s in the ER() */
String from_as_str;
from_as_str.copy(from, length, &my_charset_bin);
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"decimal", from_as_str.c_ptr(), field_name,
(ulong) table->in_use->warning_info->current_row_for_warning());
my_decimal_set_zero(&decimal_value);
break;
push_numerical_conversion_warning(table->in_use, from, length,
&my_charset_bin, "decimal",
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
field_name,
table->in_use->warning_info->current_row_for_warning());
my_decimal_set_zero(&decimal_value);
break;
}
}
......@@ -6610,13 +6627,8 @@ double Field_string::val_real(void)
!check_if_only_end_space(cs, end,
(char*) ptr + field_length))))
{
char buf[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
String tmp(buf, sizeof(buf), cs);
tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE),
"DOUBLE", tmp.c_ptr());
push_numerical_conversion_warning(current_thd, (char*)ptr, field_length,
cs, "DOUBLE", ER_TRUNCATED_WRONG_VALUE);
}
return result;
}
......@@ -6636,13 +6648,8 @@ longlong Field_string::val_int(void)
!check_if_only_end_space(cs, end,
(char*) ptr + field_length))))
{
char buf[LONGLONG_TO_STRING_CONVERSION_BUFFER_SIZE];
String tmp(buf, sizeof(buf), cs);
tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE),
"INTEGER", tmp.c_ptr());
push_numerical_conversion_warning(current_thd, (char*)ptr, field_length,
cs, "INTEGER", ER_TRUNCATED_WRONG_VALUE);
}
return result;
}
......@@ -6674,14 +6681,8 @@ my_decimal *Field_string::val_decimal(my_decimal *decimal_value)
charset(), decimal_value);
if (!table->in_use->no_errors && err)
{
char buf[DECIMAL_TO_STRING_CONVERSION_BUFFER_SIZE];
CHARSET_INFO *cs= charset();
String tmp(buf, sizeof(buf), cs);
tmp.copy((char*) ptr, field_length, cs);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE,
ER(ER_TRUNCATED_WRONG_VALUE),
"DECIMAL", tmp.c_ptr());
push_numerical_conversion_warning(current_thd, (char*)ptr, field_length,
charset(), "DECIMAL", ER_TRUNCATED_WRONG_VALUE);
}
return decimal_value;
......@@ -7113,22 +7114,46 @@ int Field_varstring::store(longlong nr, bool unsigned_val)
double Field_varstring::val_real(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
char *end_not_used;
int error;
char *end;
double result;
CHARSET_INFO* cs= charset();
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
return my_strntod(field_charset, (char*) ptr+length_bytes, length,
&end_not_used, &not_used);
result= my_strntod(cs, (char*)ptr+length_bytes, length, &end, &error);
if (!table->in_use->no_errors &&
(error || (length != (uint)(end - (char*)ptr+length_bytes) &&
!check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length))))
{
push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes,
length, cs,"DOUBLE",
ER_TRUNCATED_WRONG_VALUE);
}
return result;
}
longlong Field_varstring::val_int(void)
{
ASSERT_COLUMN_MARKED_FOR_READ;
int not_used;
char *end_not_used;
int error;
char *end;
CHARSET_INFO *cs= charset();
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
return my_strntoll(field_charset, (char*) ptr+length_bytes, length, 10,
&end_not_used, &not_used);
longlong result= my_strntoll(cs, (char*) ptr+length_bytes, length, 10,
&end, &error);
if (!table->in_use->no_errors &&
(error || (length != (uint)(end - (char*)ptr+length_bytes) &&
!check_if_only_end_space(cs, end, (char*)ptr+length_bytes+length))))
{
push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes,
length, cs, "INTEGER",
ER_TRUNCATED_WRONG_VALUE);
}
return result;
}
String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
......@@ -7144,9 +7169,17 @@ String *Field_varstring::val_str(String *val_buffer __attribute__((unused)),
my_decimal *Field_varstring::val_decimal(my_decimal *decimal_value)
{
ASSERT_COLUMN_MARKED_FOR_READ;
CHARSET_INFO *cs= charset();
uint length= length_bytes == 1 ? (uint) *ptr : uint2korr(ptr);
str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length,
charset(), decimal_value);
int error= str2my_decimal(E_DEC_FATAL_ERROR, (char*) ptr+length_bytes, length,
cs, decimal_value);
if (!table->in_use->no_errors && error)
{
push_numerical_conversion_warning(current_thd, (char*)ptr+length_bytes,
length, cs, "DECIMAL",
ER_TRUNCATED_WRONG_VALUE);
}
return decimal_value;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment