diff options
Diffstat (limited to 'mysql-test/t/variables.test')
-rw-r--r-- | mysql-test/t/variables.test | 250 |
1 files changed, 213 insertions, 37 deletions
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 74d5c8450a2..d31939ed3dd 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -33,7 +33,7 @@ set @my_query_cache_type =@@global.query_cache_type; set @my_rpl_recovery_rank =@@global.rpl_recovery_rank; set @my_server_id =@@global.server_id; set @my_slow_launch_time =@@global.slow_launch_time; -set @my_storage_engine =@@global.storage_engine; +set @my_storage_engine =@@global.default_storage_engine; set @my_thread_cache_size =@@global.thread_cache_size; set @my_max_allowed_packet =@@global.max_allowed_packet; set @my_join_buffer_size =@@global.join_buffer_size; @@ -132,12 +132,12 @@ set global timed_mutexes=0; show variables like 'timed_mutexes'; select * from information_schema.session_variables where variable_name like 'timed_mutexes'; -set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE"; -show local variables like 'storage_engine'; -select * from information_schema.session_variables where variable_name like 'storage_engine'; -show global variables like 'storage_engine'; -select * from information_schema.global_variables where variable_name like 'storage_engine'; -set GLOBAL query_cache_size=100000; +set default_storage_engine=MYISAM, default_storage_engine="HEAP", global default_storage_engine="MERGE"; +show local variables like 'default_storage_engine'; +select * from information_schema.session_variables where variable_name like 'default_storage_engine'; +show global variables like 'default_storage_engine'; +select * from information_schema.global_variables where variable_name like 'default_storage_engine'; +set GLOBAL query_cache_size=102400; set GLOBAL myisam_max_sort_file_size=2000000; show global variables like 'myisam_max_sort_file_size'; @@ -213,7 +213,6 @@ set @@query_alloc_block_size=1024*17+2; set @@query_prealloc_size=1024*18-1023; set @@transaction_alloc_block_size=1024*20-1; set @@transaction_prealloc_size=1024*21-1; -select @@query_alloc_block_size; --echo ==+ Check manipulated values ==+ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', @@ -250,14 +249,12 @@ set unknown_variable=1; --error ER_WRONG_TYPE_FOR_VAR set max_join_size="hello"; --error ER_UNKNOWN_STORAGE_ENGINE -set storage_engine=UNKNOWN_TABLE_TYPE; +set default_storage_engine=UNKNOWN_TABLE_TYPE; --error ER_WRONG_VALUE_FOR_VAR -set storage_engine=MERGE, big_tables=2; -show local variables like 'storage_engine'; +set default_storage_engine=MERGE, big_tables=2; +show local variables like 'default_storage_engine'; --error ER_GLOBAL_VARIABLE set SESSION query_cache_size=10000; ---error ER_NO_DEFAULT -set GLOBAL storage_engine=DEFAULT; --error ER_UNKNOWN_CHARACTER_SET set character_set_client=UNKNOWN_CHARACTER_SET; --error ER_UNKNOWN_COLLATION @@ -266,18 +263,12 @@ set collation_connection=UNKNOWN_COLLATION; set character_set_client=NULL; --error ER_WRONG_VALUE_FOR_VAR set collation_connection=NULL; ---error ER_LOCAL_VARIABLE -set global autocommit=1; --error ER_INCORRECT_GLOBAL_LOCAL_VAR select @@global.timestamp; --error ER_INCORRECT_GLOBAL_LOCAL_VAR set @@version=''; --error ER_GLOBAL_VARIABLE set @@concurrent_insert=1; ---error ER_LOCAL_VARIABLE -set @@global.sql_auto_is_null=1; ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -select @@global.sql_auto_is_null; --error ER_GLOBAL_VARIABLE set myisam_max_sort_file_size=100; --error ER_WRONG_VALUE_FOR_VAR @@ -355,10 +346,7 @@ set sql_big_tables=1; set sql_buffer_result=1; set sql_log_bin=1; set sql_log_off=1; -set sql_log_update=1; set sql_low_priority_updates=1; -set sql_max_join_size=200; -select @@sql_max_join_size,@@max_join_size; set sql_quote_show_create=1; set sql_safe_updates=1; set sql_select_limit=1; @@ -366,7 +354,7 @@ set sql_select_limit=1; set sql_select_limit=default; set sql_warnings=1; set global table_open_cache=100; -set storage_engine=myisam; +set default_storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; set tmp_table_size=100; @@ -559,7 +547,7 @@ select @@lc_time_names; --echo *** LC_TIME_NAMES: testing with string expressions set lc_time_names=concat('de','_','DE'); select @@lc_time_names; ---error ER_UNKNOWN_ERROR +--error ER_UNKNOWN_LOCALE set lc_time_names=concat('de','+','DE'); select @@lc_time_names; --echo LC_TIME_NAMES: testing with numeric expressions @@ -572,15 +560,15 @@ set lc_time_names=en_US; --echo LC_TIME_NAMES: testing NULL and a negative number: --error ER_WRONG_VALUE_FOR_VAR set lc_time_names=NULL; ---error ER_UNKNOWN_ERROR +--error ER_UNKNOWN_LOCALE set lc_time_names=-1; select @@lc_time_names; --echo LC_TIME_NAMES: testing locale with the last ID: -set lc_time_names=108; +set lc_time_names=109; select @@lc_time_names; --echo LC_TIME_NAMES: testing a number beyond the valid ID range: ---error ER_UNKNOWN_ERROR -set lc_time_names=109; +--error ER_UNKNOWN_LOCALE +set lc_time_names=110; select @@lc_time_names; --echo LC_TIME_NAMES: testing that 0 is en_US: set lc_time_names=0; @@ -847,7 +835,7 @@ set global query_cache_type =@my_query_cache_type; set global rpl_recovery_rank =@my_rpl_recovery_rank; set global server_id =@my_server_id; set global slow_launch_time =@my_slow_launch_time; -set global storage_engine =@my_storage_engine; +set global default_storage_engine =@my_storage_engine; set global thread_cache_size =@my_thread_cache_size; set global max_allowed_packet =@my_max_allowed_packet; set global join_buffer_size =@my_join_buffer_size; @@ -856,8 +844,8 @@ set global join_buffer_size =@my_join_buffer_size; # Bug#28580 Repeatation of status variables # --replace_column 2 # -show global variables where Variable_name='table_definition_cache' or -Variable_name='table_lock_wait_timeout'; +show global variables where Variable_name='table_definition_cache'; +# Note: table_lock_wait_timeout no longer exists. See bug#45225. ########################################################################### @@ -969,15 +957,15 @@ SET @@global.init_file= 'x'; # --echo # --replace_column 2 # -SHOW VARIABLES like 'language'; +SHOW VARIABLES like 'lc_messages_dir'; --error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.language; +SELECT @@session.lc_messages_dir; --replace_column 1 # -SELECT @@global.language; +SELECT @@global.lc_messages_dir; --error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@session.language= 'x'; +SET @@session.lc_messages_dir= 'x'; --error ER_INCORRECT_GLOBAL_LOCAL_VAR -SET @@global.language= 'x'; +SET @@global.lc_messages_dir= 'x'; # --echo # --replace_column 2 # @@ -1202,7 +1190,7 @@ SET GLOBAL auto_increment_offset=0; # --enable_metadata -select @@storage_engine; +select @@default_storage_engine; --disable_metadata # @@ -1300,3 +1288,191 @@ SET @@global.key_buffer_size=@kbs; SET @@global.key_cache_block_size=@kcbs; --echo End of 5.1 tests + +########################################################################### + +--echo +--echo # +--echo # Bug#34828: OF is taken as OFF and a value of 0 is set for variable SQL_notes. +--echo # +--echo + +--echo # Checking sql_notes... +SET @sql_notes_saved = @@sql_notes; + +--echo +SET @@sql_notes = ON; +SELECT @@sql_notes; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_notes = OF; +SELECT @@sql_notes; + +--echo +SET @@sql_notes = OFF; +SELECT @@sql_notes; + +--echo +SET @@sql_notes = @sql_notes_saved; + +--echo +--echo # Checking delay_key_write... +SET @delay_key_write_saved = @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = ON; +SELECT @@delay_key_write; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL delay_key_write = OF; +SELECT @@delay_key_write; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL delay_key_write = AL; +SELECT @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = OFF; +SELECT @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = ALL; +SELECT @@delay_key_write; + +--echo +SET GLOBAL delay_key_write = @delay_key_write_saved; + +--echo +--echo # Checking sql_safe_updates... +SET @sql_safe_updates_saved = @@sql_safe_updates; + +--echo +SET @@sql_safe_updates = ON; +SELECT @@sql_safe_updates; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_safe_updates = OF; +SELECT @@sql_safe_updates; + +--echo +SET @@sql_safe_updates = OFF; +SELECT @@sql_safe_updates; + +--echo +SET @@sql_safe_updates = @sql_safe_updates_saved; + +--echo +--echo # Checking foreign_key_checks... +SET @foreign_key_checks_saved = @@foreign_key_checks; + +--echo +SET @@foreign_key_checks = ON; +SELECT @@foreign_key_checks; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@foreign_key_checks = OF; +SELECT @@foreign_key_checks; + +--echo +SET @@foreign_key_checks = OFF; +SELECT @@foreign_key_checks; + +--echo +SET @@foreign_key_checks = @foreign_key_checks_saved; + +--echo +--echo # Checking unique_checks... +SET @unique_checks_saved = @@unique_checks; + +--echo +SET @@unique_checks = ON; +SELECT @@unique_checks; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@unique_checks = OF; +SELECT @@unique_checks; + +--echo +SET @@unique_checks = OFF; +SELECT @@unique_checks; + +--echo +SET @@unique_checks = @unique_checks_saved; + +--echo +--echo # Checking sql_buffer_result... +SET @sql_buffer_result_saved = @@sql_buffer_result; + +--echo +SET @@sql_buffer_result = ON; +SELECT @@sql_buffer_result; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_buffer_result = OF; +SELECT @@sql_buffer_result; + +--echo +SET @@sql_buffer_result = OFF; +SELECT @@sql_buffer_result; + +--echo +SET @@sql_buffer_result = @sql_buffer_result_saved; + +--echo +--echo # Checking sql_quote_show_create... +SET @sql_quote_show_create_saved = @@sql_quote_show_create; + +--echo +SET @@sql_quote_show_create = ON; +SELECT @@sql_quote_show_create; + +--echo +--error ER_WRONG_VALUE_FOR_VAR +SET @@sql_quote_show_create = OF; +SELECT @@sql_quote_show_create; + +--echo +SET @@sql_quote_show_create = OFF; +SELECT @@sql_quote_show_create; + +--echo +SET @@sql_quote_show_create = @sql_quote_show_create_saved; + +--echo +--echo # End of Bug#34828. +--echo + +--echo # Make sure we can manipulate with autocommit in the +--echo # along with other variables. + + +--disable_warnings +drop table if exists t1; +drop function if exists t1_max; +drop function if exists t1_min; +--enable_warnings + +create table t1 (a int) engine=innodb; +insert into t1(a) values (0), (1); +create function t1_max() returns int return (select max(a) from t1); +create function t1_min() returns int return (select min(a) from t1); +select t1_min(); +select t1_max(); +set @@session.autocommit=t1_min(), @@session.autocommit=t1_max(), + @@session.autocommit=t1_min(), @@session.autocommit=t1_max(), + @@session.autocommit=t1_min(), @@session.autocommit=t1_max(); + +--echo # Cleanup. +drop table t1; +drop function t1_min; +drop function t1_max; + + +########################################################################### |