mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-6954: SET STATEMENT rand_seedX = ...FOR ... makes the next rand() to return 0
The variables now return real values. They can't be made usual variables because they do not have DEFAULT value.
This commit is contained in:
@ -1122,10 +1122,6 @@ set statement autocommit=default for select 1;
|
|||||||
ERROR 42000: The system variable autocommit cannot be set in SET STATEMENT.
|
ERROR 42000: The system variable autocommit cannot be set in SET STATEMENT.
|
||||||
set statement tx_isolation=default for select 1;
|
set statement tx_isolation=default for select 1;
|
||||||
ERROR 42000: The system variable tx_isolation cannot be set in SET STATEMENT.
|
ERROR 42000: The system variable tx_isolation cannot be set in SET STATEMENT.
|
||||||
set statement rand_seed1=default for select 1;
|
|
||||||
ERROR 42000: The system variable rand_seed1 cannot be set in SET STATEMENT.
|
|
||||||
set statement rand_seed2=default for select 1;
|
|
||||||
ERROR 42000: The system variable rand_seed2 cannot be set in SET STATEMENT.
|
|
||||||
set statement skip_replication=default for select 1;
|
set statement skip_replication=default for select 1;
|
||||||
ERROR 42000: The system variable skip_replication cannot be set in SET STATEMENT.
|
ERROR 42000: The system variable skip_replication cannot be set in SET STATEMENT.
|
||||||
set statement sql_log_off=default for select 1;
|
set statement sql_log_off=default for select 1;
|
||||||
@ -1214,3 +1210,13 @@ ERROR HY000: Unknown system variable 'non_existing'
|
|||||||
show errors;
|
show errors;
|
||||||
Level Code Message
|
Level Code Message
|
||||||
Error 1193 Unknown system variable 'non_existing'
|
Error 1193 Unknown system variable 'non_existing'
|
||||||
|
#
|
||||||
|
# MDEV-6954: SET STATEMENT rand_seedX = ...FOR ... makes
|
||||||
|
# the next rand() to return 0
|
||||||
|
#
|
||||||
|
set @rnd=1;
|
||||||
|
# test that rand() is not always 0 after restoring rand_seed, rand_seed2...
|
||||||
|
# @rnd should be 0
|
||||||
|
select @rnd;
|
||||||
|
@rnd
|
||||||
|
0
|
||||||
|
@ -25,6 +25,8 @@ select * from information_schema.system_variables
|
|||||||
'lower_case_file_system',
|
'lower_case_file_system',
|
||||||
'lower_case_table_names',
|
'lower_case_table_names',
|
||||||
'open_files_limit',
|
'open_files_limit',
|
||||||
|
'rand_seed1',
|
||||||
|
'rand_seed2',
|
||||||
'system_time_zone',
|
'system_time_zone',
|
||||||
'version_comment',
|
'version_comment',
|
||||||
'version_compile_machine', 'version_compile_os',
|
'version_compile_machine', 'version_compile_os',
|
||||||
@ -46,6 +48,8 @@ select VARIABLE_NAME, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT,
|
|||||||
'lower_case_file_system',
|
'lower_case_file_system',
|
||||||
'lower_case_table_names',
|
'lower_case_table_names',
|
||||||
'open_files_limit',
|
'open_files_limit',
|
||||||
|
'rand_seed1',
|
||||||
|
'rand_seed2',
|
||||||
'system_time_zone',
|
'system_time_zone',
|
||||||
'version_comment',
|
'version_comment',
|
||||||
'version_compile_machine', 'version_compile_os',
|
'version_compile_machine', 'version_compile_os',
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
select @@global.rand_seed1;
|
select @@global.rand_seed1;
|
||||||
ERROR HY000: Variable 'rand_seed1' is a SESSION variable
|
ERROR HY000: Variable 'rand_seed1' is a SESSION variable
|
||||||
|
set session rand_seed1=default;
|
||||||
|
ERROR 42000: Variable 'rand_seed1' doesn't have a default value
|
||||||
|
set session rand_seed1=10969771;
|
||||||
select @@session.rand_seed1;
|
select @@session.rand_seed1;
|
||||||
@@session.rand_seed1
|
@@session.rand_seed1
|
||||||
0
|
10969771
|
||||||
show global variables like 'rand_seed1';
|
show global variables like 'rand_seed1';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
show session variables like 'rand_seed1';
|
show session variables like 'rand_seed1';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
rand_seed1 0
|
rand_seed1 10969771
|
||||||
select * from information_schema.global_variables where variable_name='rand_seed1';
|
select * from information_schema.global_variables where variable_name='rand_seed1';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
select * from information_schema.session_variables where variable_name='rand_seed1';
|
select * from information_schema.session_variables where variable_name='rand_seed1';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
RAND_SEED1 0
|
RAND_SEED1 10969771
|
||||||
set session rand_seed1=1;
|
set session rand_seed1=1;
|
||||||
select @@session.rand_seed1;
|
select @@session.rand_seed1;
|
||||||
@@session.rand_seed1
|
@@session.rand_seed1
|
||||||
0
|
1
|
||||||
select * from information_schema.global_variables where variable_name='rand_seed1';
|
select * from information_schema.global_variables where variable_name='rand_seed1';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
select * from information_schema.session_variables where variable_name='rand_seed1';
|
select * from information_schema.session_variables where variable_name='rand_seed1';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
RAND_SEED1 0
|
RAND_SEED1 1
|
||||||
set global rand_seed1=1;
|
set global rand_seed1=1;
|
||||||
ERROR HY000: Variable 'rand_seed1' is a SESSION variable and can't be used with SET GLOBAL
|
ERROR HY000: Variable 'rand_seed1' is a SESSION variable and can't be used with SET GLOBAL
|
||||||
set session rand_seed1=1.1;
|
set session rand_seed1=1.1;
|
||||||
|
@ -1,27 +1,30 @@
|
|||||||
select @@global.rand_seed2;
|
select @@global.rand_seed2;
|
||||||
ERROR HY000: Variable 'rand_seed2' is a SESSION variable
|
ERROR HY000: Variable 'rand_seed2' is a SESSION variable
|
||||||
|
set session rand_seed2=default;
|
||||||
|
ERROR 42000: Variable 'rand_seed2' doesn't have a default value
|
||||||
|
set session rand_seed2=10969771;
|
||||||
select @@session.rand_seed2;
|
select @@session.rand_seed2;
|
||||||
@@session.rand_seed2
|
@@session.rand_seed2
|
||||||
0
|
10969771
|
||||||
show global variables like 'rand_seed2';
|
show global variables like 'rand_seed2';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
show session variables like 'rand_seed2';
|
show session variables like 'rand_seed2';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
rand_seed2 0
|
rand_seed2 10969771
|
||||||
select * from information_schema.global_variables where variable_name='rand_seed2';
|
select * from information_schema.global_variables where variable_name='rand_seed2';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
select * from information_schema.session_variables where variable_name='rand_seed2';
|
select * from information_schema.session_variables where variable_name='rand_seed2';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
RAND_SEED2 0
|
RAND_SEED2 10969771
|
||||||
set session rand_seed2=1;
|
set session rand_seed2=1;
|
||||||
select @@session.rand_seed2;
|
select @@session.rand_seed2;
|
||||||
@@session.rand_seed2
|
@@session.rand_seed2
|
||||||
0
|
1
|
||||||
select * from information_schema.global_variables where variable_name='rand_seed2';
|
select * from information_schema.global_variables where variable_name='rand_seed2';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
select * from information_schema.session_variables where variable_name='rand_seed2';
|
select * from information_schema.session_variables where variable_name='rand_seed2';
|
||||||
VARIABLE_NAME VARIABLE_VALUE
|
VARIABLE_NAME VARIABLE_VALUE
|
||||||
RAND_SEED2 0
|
RAND_SEED2 1
|
||||||
set global rand_seed2=1;
|
set global rand_seed2=1;
|
||||||
ERROR HY000: Variable 'rand_seed2' is a SESSION variable and can't be used with SET GLOBAL
|
ERROR HY000: Variable 'rand_seed2' is a SESSION variable and can't be used with SET GLOBAL
|
||||||
set session rand_seed2=1.1;
|
set session rand_seed2=1.1;
|
||||||
|
@ -15,6 +15,8 @@ variable_name not in (
|
|||||||
'lower_case_file_system',
|
'lower_case_file_system',
|
||||||
'lower_case_table_names',
|
'lower_case_table_names',
|
||||||
'open_files_limit',
|
'open_files_limit',
|
||||||
|
'rand_seed1',
|
||||||
|
'rand_seed2',
|
||||||
'system_time_zone',
|
'system_time_zone',
|
||||||
'version_comment',
|
'version_comment',
|
||||||
'version_compile_machine', 'version_compile_os',
|
'version_compile_machine', 'version_compile_os',
|
||||||
@ -3087,34 +3089,6 @@ NUMERIC_BLOCK_SIZE 1024
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY NO
|
READ_ONLY NO
|
||||||
COMMAND_LINE_ARGUMENT REQUIRED
|
COMMAND_LINE_ARGUMENT REQUIRED
|
||||||
VARIABLE_NAME RAND_SEED1
|
|
||||||
SESSION_VALUE 0
|
|
||||||
GLOBAL_VALUE NULL
|
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
|
||||||
DEFAULT_VALUE 0
|
|
||||||
VARIABLE_SCOPE SESSION ONLY
|
|
||||||
VARIABLE_TYPE BIGINT UNSIGNED
|
|
||||||
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
|
||||||
NUMERIC_MIN_VALUE 0
|
|
||||||
NUMERIC_MAX_VALUE 18446744073709551615
|
|
||||||
NUMERIC_BLOCK_SIZE 1
|
|
||||||
ENUM_VALUE_LIST NULL
|
|
||||||
READ_ONLY NO
|
|
||||||
COMMAND_LINE_ARGUMENT NULL
|
|
||||||
VARIABLE_NAME RAND_SEED2
|
|
||||||
SESSION_VALUE 0
|
|
||||||
GLOBAL_VALUE NULL
|
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
|
||||||
DEFAULT_VALUE 0
|
|
||||||
VARIABLE_SCOPE SESSION ONLY
|
|
||||||
VARIABLE_TYPE BIGINT UNSIGNED
|
|
||||||
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
|
||||||
NUMERIC_MIN_VALUE 0
|
|
||||||
NUMERIC_MAX_VALUE 18446744073709551615
|
|
||||||
NUMERIC_BLOCK_SIZE 1
|
|
||||||
ENUM_VALUE_LIST NULL
|
|
||||||
READ_ONLY NO
|
|
||||||
COMMAND_LINE_ARGUMENT NULL
|
|
||||||
VARIABLE_NAME RANGE_ALLOC_BLOCK_SIZE
|
VARIABLE_NAME RANGE_ALLOC_BLOCK_SIZE
|
||||||
SESSION_VALUE 4096
|
SESSION_VALUE 4096
|
||||||
GLOBAL_VALUE 4096
|
GLOBAL_VALUE 4096
|
||||||
@ -4051,6 +4025,8 @@ where variable_name in (
|
|||||||
'lower_case_file_system',
|
'lower_case_file_system',
|
||||||
'lower_case_table_names',
|
'lower_case_table_names',
|
||||||
'open_files_limit',
|
'open_files_limit',
|
||||||
|
'rand_seed1',
|
||||||
|
'rand_seed2',
|
||||||
'system_time_zone',
|
'system_time_zone',
|
||||||
'version_comment',
|
'version_comment',
|
||||||
'version_compile_machine', 'version_compile_os',
|
'version_compile_machine', 'version_compile_os',
|
||||||
@ -4127,6 +4103,26 @@ NUMERIC_BLOCK_SIZE 1
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY YES
|
READ_ONLY YES
|
||||||
COMMAND_LINE_ARGUMENT REQUIRED
|
COMMAND_LINE_ARGUMENT REQUIRED
|
||||||
|
VARIABLE_NAME RAND_SEED1
|
||||||
|
VARIABLE_SCOPE SESSION ONLY
|
||||||
|
VARIABLE_TYPE BIGINT UNSIGNED
|
||||||
|
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
||||||
|
NUMERIC_MIN_VALUE 0
|
||||||
|
NUMERIC_MAX_VALUE 18446744073709551615
|
||||||
|
NUMERIC_BLOCK_SIZE 1
|
||||||
|
ENUM_VALUE_LIST NULL
|
||||||
|
READ_ONLY NO
|
||||||
|
COMMAND_LINE_ARGUMENT NULL
|
||||||
|
VARIABLE_NAME RAND_SEED2
|
||||||
|
VARIABLE_SCOPE SESSION ONLY
|
||||||
|
VARIABLE_TYPE BIGINT UNSIGNED
|
||||||
|
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
||||||
|
NUMERIC_MIN_VALUE 0
|
||||||
|
NUMERIC_MAX_VALUE 18446744073709551615
|
||||||
|
NUMERIC_BLOCK_SIZE 1
|
||||||
|
ENUM_VALUE_LIST NULL
|
||||||
|
READ_ONLY NO
|
||||||
|
COMMAND_LINE_ARGUMENT NULL
|
||||||
VARIABLE_NAME SYSTEM_TIME_ZONE
|
VARIABLE_NAME SYSTEM_TIME_ZONE
|
||||||
VARIABLE_SCOPE GLOBAL
|
VARIABLE_SCOPE GLOBAL
|
||||||
VARIABLE_TYPE VARCHAR
|
VARIABLE_TYPE VARCHAR
|
||||||
|
@ -15,6 +15,8 @@ variable_name not in (
|
|||||||
'lower_case_file_system',
|
'lower_case_file_system',
|
||||||
'lower_case_table_names',
|
'lower_case_table_names',
|
||||||
'open_files_limit',
|
'open_files_limit',
|
||||||
|
'rand_seed1',
|
||||||
|
'rand_seed2',
|
||||||
'system_time_zone',
|
'system_time_zone',
|
||||||
'version_comment',
|
'version_comment',
|
||||||
'version_compile_machine', 'version_compile_os',
|
'version_compile_machine', 'version_compile_os',
|
||||||
@ -3269,34 +3271,6 @@ NUMERIC_BLOCK_SIZE 1024
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY NO
|
READ_ONLY NO
|
||||||
COMMAND_LINE_ARGUMENT REQUIRED
|
COMMAND_LINE_ARGUMENT REQUIRED
|
||||||
VARIABLE_NAME RAND_SEED1
|
|
||||||
SESSION_VALUE 0
|
|
||||||
GLOBAL_VALUE NULL
|
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
|
||||||
DEFAULT_VALUE 0
|
|
||||||
VARIABLE_SCOPE SESSION ONLY
|
|
||||||
VARIABLE_TYPE BIGINT UNSIGNED
|
|
||||||
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
|
||||||
NUMERIC_MIN_VALUE 0
|
|
||||||
NUMERIC_MAX_VALUE 18446744073709551615
|
|
||||||
NUMERIC_BLOCK_SIZE 1
|
|
||||||
ENUM_VALUE_LIST NULL
|
|
||||||
READ_ONLY NO
|
|
||||||
COMMAND_LINE_ARGUMENT NULL
|
|
||||||
VARIABLE_NAME RAND_SEED2
|
|
||||||
SESSION_VALUE 0
|
|
||||||
GLOBAL_VALUE NULL
|
|
||||||
GLOBAL_VALUE_ORIGIN COMPILE-TIME
|
|
||||||
DEFAULT_VALUE 0
|
|
||||||
VARIABLE_SCOPE SESSION ONLY
|
|
||||||
VARIABLE_TYPE BIGINT UNSIGNED
|
|
||||||
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
|
||||||
NUMERIC_MIN_VALUE 0
|
|
||||||
NUMERIC_MAX_VALUE 18446744073709551615
|
|
||||||
NUMERIC_BLOCK_SIZE 1
|
|
||||||
ENUM_VALUE_LIST NULL
|
|
||||||
READ_ONLY NO
|
|
||||||
COMMAND_LINE_ARGUMENT NULL
|
|
||||||
VARIABLE_NAME RANGE_ALLOC_BLOCK_SIZE
|
VARIABLE_NAME RANGE_ALLOC_BLOCK_SIZE
|
||||||
SESSION_VALUE 4096
|
SESSION_VALUE 4096
|
||||||
GLOBAL_VALUE 4096
|
GLOBAL_VALUE 4096
|
||||||
@ -4793,6 +4767,8 @@ where variable_name in (
|
|||||||
'lower_case_file_system',
|
'lower_case_file_system',
|
||||||
'lower_case_table_names',
|
'lower_case_table_names',
|
||||||
'open_files_limit',
|
'open_files_limit',
|
||||||
|
'rand_seed1',
|
||||||
|
'rand_seed2',
|
||||||
'system_time_zone',
|
'system_time_zone',
|
||||||
'version_comment',
|
'version_comment',
|
||||||
'version_compile_machine', 'version_compile_os',
|
'version_compile_machine', 'version_compile_os',
|
||||||
@ -4869,6 +4845,26 @@ NUMERIC_BLOCK_SIZE 1
|
|||||||
ENUM_VALUE_LIST NULL
|
ENUM_VALUE_LIST NULL
|
||||||
READ_ONLY YES
|
READ_ONLY YES
|
||||||
COMMAND_LINE_ARGUMENT REQUIRED
|
COMMAND_LINE_ARGUMENT REQUIRED
|
||||||
|
VARIABLE_NAME RAND_SEED1
|
||||||
|
VARIABLE_SCOPE SESSION ONLY
|
||||||
|
VARIABLE_TYPE BIGINT UNSIGNED
|
||||||
|
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
||||||
|
NUMERIC_MIN_VALUE 0
|
||||||
|
NUMERIC_MAX_VALUE 18446744073709551615
|
||||||
|
NUMERIC_BLOCK_SIZE 1
|
||||||
|
ENUM_VALUE_LIST NULL
|
||||||
|
READ_ONLY NO
|
||||||
|
COMMAND_LINE_ARGUMENT NULL
|
||||||
|
VARIABLE_NAME RAND_SEED2
|
||||||
|
VARIABLE_SCOPE SESSION ONLY
|
||||||
|
VARIABLE_TYPE BIGINT UNSIGNED
|
||||||
|
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
|
||||||
|
NUMERIC_MIN_VALUE 0
|
||||||
|
NUMERIC_MAX_VALUE 18446744073709551615
|
||||||
|
NUMERIC_BLOCK_SIZE 1
|
||||||
|
ENUM_VALUE_LIST NULL
|
||||||
|
READ_ONLY NO
|
||||||
|
COMMAND_LINE_ARGUMENT NULL
|
||||||
VARIABLE_NAME SYSTEM_TIME_ZONE
|
VARIABLE_NAME SYSTEM_TIME_ZONE
|
||||||
VARIABLE_SCOPE GLOBAL
|
VARIABLE_SCOPE GLOBAL
|
||||||
VARIABLE_TYPE VARCHAR
|
VARIABLE_TYPE VARCHAR
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#
|
#
|
||||||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||||
select @@global.rand_seed1;
|
select @@global.rand_seed1;
|
||||||
|
--error ER_NO_DEFAULT
|
||||||
|
set session rand_seed1=default;
|
||||||
|
set session rand_seed1=10969771;
|
||||||
select @@session.rand_seed1;
|
select @@session.rand_seed1;
|
||||||
show global variables like 'rand_seed1';
|
show global variables like 'rand_seed1';
|
||||||
show session variables like 'rand_seed1';
|
show session variables like 'rand_seed1';
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
#
|
#
|
||||||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||||
select @@global.rand_seed2;
|
select @@global.rand_seed2;
|
||||||
|
--error ER_NO_DEFAULT
|
||||||
|
set session rand_seed2=default;
|
||||||
|
set session rand_seed2=10969771;
|
||||||
select @@session.rand_seed2;
|
select @@session.rand_seed2;
|
||||||
show global variables like 'rand_seed2';
|
show global variables like 'rand_seed2';
|
||||||
show session variables like 'rand_seed2';
|
show session variables like 'rand_seed2';
|
||||||
|
@ -1050,10 +1050,6 @@ set statement autocommit=default for select 1;
|
|||||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||||
set statement tx_isolation=default for select 1;
|
set statement tx_isolation=default for select 1;
|
||||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||||
set statement rand_seed1=default for select 1;
|
|
||||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
|
||||||
set statement rand_seed2=default for select 1;
|
|
||||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
|
||||||
set statement skip_replication=default for select 1;
|
set statement skip_replication=default for select 1;
|
||||||
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
--error ER_SET_STATEMENT_NOT_SUPPORTED
|
||||||
set statement sql_log_off=default for select 1;
|
set statement sql_log_off=default for select 1;
|
||||||
@ -1115,3 +1111,23 @@ set @@old_passwords=@save_old_passwords;
|
|||||||
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
--error ER_UNKNOWN_SYSTEM_VARIABLE
|
||||||
set statement non_existing=1 for select 1;
|
set statement non_existing=1 for select 1;
|
||||||
show errors;
|
show errors;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-6954: SET STATEMENT rand_seedX = ...FOR ... makes
|
||||||
|
--echo # the next rand() to return 0
|
||||||
|
--echo #
|
||||||
|
set @rnd=1;
|
||||||
|
let $1=10;
|
||||||
|
--disable_query_log
|
||||||
|
--echo # test that rand() is not always 0 after restoring rand_seed, rand_seed2...
|
||||||
|
while ($1)
|
||||||
|
{
|
||||||
|
--disable_result_log
|
||||||
|
set statement rand_seed1=1, rand_seed2=1 for select 1;
|
||||||
|
--enable_result_log
|
||||||
|
set @rnd= rand()=0 and @rnd;
|
||||||
|
dec $1;
|
||||||
|
}
|
||||||
|
--enable_query_log
|
||||||
|
--echo # @rnd should be 0
|
||||||
|
select @rnd;
|
||||||
|
@ -3830,17 +3830,17 @@ static bool update_rand_seed1(THD *thd, set_var *var)
|
|||||||
thd->rand.seed1= (ulong) var->save_result.ulonglong_value;
|
thd->rand.seed1= (ulong) var->save_result.ulonglong_value;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
static ulonglong read_rand_seed(THD *thd)
|
static ulonglong read_rand_seed1(THD *thd)
|
||||||
{
|
{
|
||||||
return 0;
|
return thd->rand.seed1;
|
||||||
}
|
}
|
||||||
static Sys_var_session_special Sys_rand_seed1(
|
static Sys_var_session_special Sys_rand_seed1(
|
||||||
"rand_seed1", "Sets the internal state of the RAND() "
|
"rand_seed1", "Sets the internal state of the RAND() "
|
||||||
"generator for replication purposes",
|
"generator for replication purposes",
|
||||||
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
|
sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||||
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
|
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
|
||||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
||||||
ON_UPDATE(update_rand_seed1), ON_READ(read_rand_seed));
|
ON_UPDATE(update_rand_seed1), ON_READ(read_rand_seed1));
|
||||||
|
|
||||||
static bool update_rand_seed2(THD *thd, set_var *var)
|
static bool update_rand_seed2(THD *thd, set_var *var)
|
||||||
{
|
{
|
||||||
@ -3852,13 +3852,17 @@ static bool update_rand_seed2(THD *thd, set_var *var)
|
|||||||
thd->rand.seed2= (ulong) var->save_result.ulonglong_value;
|
thd->rand.seed2= (ulong) var->save_result.ulonglong_value;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
static ulonglong read_rand_seed2(THD *thd)
|
||||||
|
{
|
||||||
|
return thd->rand.seed2;
|
||||||
|
}
|
||||||
static Sys_var_session_special Sys_rand_seed2(
|
static Sys_var_session_special Sys_rand_seed2(
|
||||||
"rand_seed2", "Sets the internal state of the RAND() "
|
"rand_seed2", "Sets the internal state of the RAND() "
|
||||||
"generator for replication purposes",
|
"generator for replication purposes",
|
||||||
NO_SET_STMT sys_var::ONLY_SESSION, NO_CMD_LINE,
|
sys_var::ONLY_SESSION, NO_CMD_LINE,
|
||||||
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
|
VALID_RANGE(0, ULONG_MAX), BLOCK_SIZE(1),
|
||||||
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
NO_MUTEX_GUARD, IN_BINLOG, ON_CHECK(0),
|
||||||
ON_UPDATE(update_rand_seed2), ON_READ(read_rand_seed));
|
ON_UPDATE(update_rand_seed2), ON_READ(read_rand_seed2));
|
||||||
|
|
||||||
static ulonglong read_error_count(THD *thd)
|
static ulonglong read_error_count(THD *thd)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user