polardbxengine/mysql-test/suite/sys_vars/t/max_execution_time_basic.test

215 lines
7.1 KiB
Plaintext

#
--source include/have_statement_timeout.inc
--echo # Initial values
SELECT @@global.max_execution_time, @@session.max_execution_time;
--echo # Save initial value
SET @start_global_value= @@global.max_execution_time;
SELECT @start_global_value;
SET @start_session_value = @@session.max_execution_time;
SELECT @start_session_value;
--echo # Display the DEFAULT value of max_execution_time
SET @@session.max_execution_time = 20000;
SET @@session.max_execution_time = DEFAULT;
SELECT @@session.max_execution_time;
SET @@global.max_execution_time = 20000;
SET @@global.max_execution_time = DEFAULT;
SELECT @@global.max_execution_time;
--echo # Check the DEFAULT value of max_execution_time
SET @@global.max_execution_time = DEFAULT;
SELECT @@global.max_execution_time = 28800;
SET @@session.max_execution_time = DEFAULT;
SELECT @@session.max_execution_time = 28800;
--echo # Check Max value for max_execution_time.
--disable_query_log
--disable_warnings
SET @@global.max_execution_time = 4294967296;
let $value_of_32bit = `SELECT @@global.max_execution_time <= 4294967295 OR
convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows")`;
if ($value_of_32bit)
{
eval SET @@global.max_execution_time= 4294967295;
eval SET @@session.max_execution_time= 4294967295;
--error 0,ER_WRONG_TYPE_FOR_VAR
eval SET @@global.max_execution_time= 4294967296;
--error 0,ER_WRONG_TYPE_FOR_VAR
eval SET @@session.max_execution_time= 4294967296;
let $max_global_value= `SELECT @@global.max_execution_time = 4294967295`;
let $max_session_value= `SELECT @@session.max_execution_time = 4294967295`;
if ($max_global_value)
{
echo "Max value for @@global.max_execution_time is set properly.";
}
if ($max_session_value)
{
echo "Max value for @@session.max_execution_time is set properly.";
}
}
if (!$value_of_32bit)
{
eval SET @@global.max_execution_time= 1844674407370955615;
eval SET @@session.max_execution_time= 1844674407370955615;
--error 0,ER_WRONG_TYPE_FOR_VAR
eval SET @@global.max_execution_time= 18446744073709551616;
--error 0,ER_WRONG_TYPE_FOR_VAR
eval SET @@session.max_execution_time= 18446744073709551616;
let $max_global_value= `SELECT @@global.max_execution_time = 1844674407370955615`;
let $max_session_value= `SELECT @@session.max_execution_time = 1844674407370955615`;
if ($max_global_value)
{
echo "Max value for @@global.max_execution_time is set properly.";
}
if ($max_session_value)
{
echo "Max value for @@session.max_execution_time is set properly.";
}
}
--enable_warnings
--enable_query_log
SET @@global.max_execution_time = 0;
SELECT @@global.max_execution_time;
SET @@session.max_execution_time = 0;
SELECT @@global.max_execution_time;
--echo # Change the value of max_execution_time to a valid value for SESSION scope
SET @@session.max_execution_time = 10000;
SELECT @@global.max_execution_time, @@session.max_execution_time;
SET @@session.max_execution_time = 50050;
SELECT @@global.max_execution_time, @@session.max_execution_time;
SET @@session.max_execution_time = 65535;
SELECT @@global.max_execution_time, @@session.max_execution_time;
--echo # Change the value of max_execution_time to an invalid value #
SET @@global.max_execution_time = -2;
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = 65530.34;
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = test;
SELECT @@global.max_execution_time;
--echo # Change the value of max_execution_time to a valid value for SESSION scope
SET @@session.max_execution_time = 10000;
SELECT @@global.max_execution_time, @@session.max_execution_time;
SET @@session.max_execution_time = 50050;
SELECT @@global.max_execution_time, @@session.max_execution_time;
SET @@session.max_execution_time = 65535;
SELECT @@global.max_execution_time, @@session.max_execution_time;
--echo # Change the value of max_execution_time to an invalid value #
SET @@global.max_execution_time = -2;
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = 65530.34;
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = test;
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = "";
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = "*";
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = NULL;
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = "0";
SELECT @@global.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@global.max_execution_time = "*#$**$(@(@ ##@";
SELECT @@global.max_execution_time;
SET @@session.max_execution_time = -2;
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = 65530.34;
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = test;
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = "";
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = "*";
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = NULL;
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = "0";
SELECT @@session.max_execution_time;
--error ER_WRONG_TYPE_FOR_VAR
SET @@session.max_execution_time = "*#$**$(@(@ ##@";
SELECT @@session.max_execution_time;
--echo # Check if the value in GLOBAL Table matches value in variable
--disable_warnings
SELECT @@global.max_execution_time = VARIABLE_VALUE
FROM performance_schema.global_variables
WHERE VARIABLE_NAME='max_execution_time';
--enable_warnings
--echo # Check if the value in SESSION Table matches value in variable
--disable_warnings
SELECT @@session.max_execution_time = VARIABLE_VALUE
FROM performance_schema.session_variables
WHERE VARIABLE_NAME='max_execution_time';
--enable_warnings
--echo # Check if TRUE and FALSE values can be used on variable
SET @@global.max_execution_time = TRUE;
SELECT @@global.max_execution_time;
SET @@global.max_execution_time = FALSE;
SELECT @@global.max_execution_time;
SET @@session.max_execution_time = TRUE;
SELECT @@session.max_execution_time;
SET @@session.max_execution_time = FALSE;
SELECT @@session.max_execution_time;
--echo # Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable
SET @@max_execution_time = 10000;
SELECT @@max_execution_time = @@local.max_execution_time;
SELECT @@local.max_execution_time = @@session.max_execution_time;
--echo # Check if max_execution_time can be accessed with and without @@ sign
SET max_execution_time = 10000;
SELECT @@max_execution_time;
--error ER_UNKNOWN_TABLE
SELECT local.max_execution_time;
--error ER_UNKNOWN_TABLE
SELECT session.max_execution_time;
--echo # Restore initial value
SET @@global.max_execution_time = @start_global_value;
SELECT @@global.max_execution_time;
SET @@session.max_execution_time = @start_session_value;
SELECT @@session.max_execution_time;