Commit 04451f0f authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-14765 Server crashes in Sys_var_vers_asof::update

parent 11c68827
......@@ -39,6 +39,7 @@ set system_versioning_asof= 1;
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
set system_versioning_asof= 1.1;
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
# GLOBAL @@system_versioning_asof
set global system_versioning_asof= '1911-11-11 11:11:11.1111119';
Warnings:
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
......@@ -61,6 +62,11 @@ set global system_versioning_asof= @ts;
show global variables like 'system_versioning_asof';
Variable_name Value
system_versioning_asof 1900-01-01 00:00:00.000000
set global system_versioning_asof= default;
select @@global.system_versioning_asof;
@@global.system_versioning_asof
DEFAULT
# SESSION @@system_versioning_asof
set system_versioning_asof= '1911-11-11 11:11:11.1111119';
Warnings:
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
......@@ -83,8 +89,21 @@ set system_versioning_asof= @ts;
show variables like 'system_versioning_asof';
Variable_name Value
system_versioning_asof 1900-01-01 00:00:00.000000
# DEFAULT: value is copied from GLOBAL to SESSION
set global system_versioning_asof= timestamp'1911-11-11 11:11:11.111111';
set system_versioning_asof= '1900-01-01 00:00:00';
select @@global.system_versioning_asof != @@system_versioning_asof as different;
different
1
set system_versioning_asof= default;
select @@global.system_versioning_asof = @@system_versioning_asof as equal;
equal
1
set global system_versioning_asof= DEFAULT;
set system_versioning_asof= DEFAULT;
select @@global.system_versioning_asof, @@system_versioning_asof;
@@global.system_versioning_asof @@system_versioning_asof
DEFAULT DEFAULT
show variables where variable_name = "system_versioning_hide";
Variable_name Value
system_versioning_hide IMPLICIT
......
......@@ -34,7 +34,7 @@ set system_versioning_asof= 1;
--error ER_WRONG_TYPE_FOR_VAR
set system_versioning_asof= 1.1;
# global
--echo # GLOBAL @@system_versioning_asof
set global system_versioning_asof= '1911-11-11 11:11:11.1111119';
show global variables like 'system_versioning_asof';
......@@ -48,7 +48,10 @@ set @ts= timestamp'1900-01-01 00:00:00';
set global system_versioning_asof= @ts;
show global variables like 'system_versioning_asof';
# session
set global system_versioning_asof= default;
select @@global.system_versioning_asof;
--echo # SESSION @@system_versioning_asof
set system_versioning_asof= '1911-11-11 11:11:11.1111119';
show variables like 'system_versioning_asof';
......@@ -62,8 +65,16 @@ set @ts= timestamp'1900-01-01 00:00:00';
set system_versioning_asof= @ts;
show variables like 'system_versioning_asof';
--echo # DEFAULT: value is copied from GLOBAL to SESSION
set global system_versioning_asof= timestamp'1911-11-11 11:11:11.111111';
set system_versioning_asof= '1900-01-01 00:00:00';
select @@global.system_versioning_asof != @@system_versioning_asof as different;
set system_versioning_asof= default;
select @@global.system_versioning_asof = @@system_versioning_asof as equal;
set global system_versioning_asof= DEFAULT;
set system_versioning_asof= DEFAULT;
select @@global.system_versioning_asof, @@system_versioning_asof;
show variables where variable_name = "system_versioning_hide";
select * from t for system_time all;
......
......@@ -2640,7 +2640,15 @@ private:
out.type= static_cast<enum_var_type>(var->save_result.ulonglong_value);
if (out.type == SYSTEM_TIME_AS_OF)
{
res= var->value->get_date(&out.ltime, 0);
if (var->value)
{
res= var->value->get_date(&out.ltime, 0);
}
else // set DEFAULT from global var
{
out= global_var(vers_asof_timestamp_t);
res= false;
}
}
return res;
}
......
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