1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

MDEV-17798 System variable system_versioning_asof accepts wrong values (10.4)

This commit is contained in:
Aleksey Midenkov
2020-02-02 15:13:29 +03:00
parent 5a6023cf6f
commit b615d275b8
3 changed files with 39 additions and 2 deletions

View File

@ -31,6 +31,14 @@ set global system_versioning_asof= 1;
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof' ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
set global system_versioning_asof= 1.1; set global system_versioning_asof= 1.1;
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof' ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
set global system_versioning_asof= '2011-02-29 00:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-29 00:00'
set global system_versioning_asof= '2011-02-28 24:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-28 24:00'
set global system_versioning_asof= '2011-00-28 00:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-00-28 00:00'
set global system_versioning_asof= '0000-00-00 00:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '0000-00-00 00:00'
set system_versioning_asof= 'alley'; set system_versioning_asof= 'alley';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of 'alley' ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of 'alley'
set system_versioning_asof= null; set system_versioning_asof= null;
@ -39,6 +47,14 @@ set system_versioning_asof= 1;
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof' ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
set system_versioning_asof= 1.1; set system_versioning_asof= 1.1;
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof' ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
set system_versioning_asof= '2011-02-29 00:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-29 00:00'
set system_versioning_asof= '2011-02-28 24:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-28 24:00'
set system_versioning_asof= '2011-00-28 00:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-00-28 00:00'
set system_versioning_asof= '0000-00-00 00:00';
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '0000-00-00 00:00'
# GLOBAL @@system_versioning_asof # GLOBAL @@system_versioning_asof
set global system_versioning_asof= '1911-11-11 11:11:11.1111119'; set global system_versioning_asof= '1911-11-11 11:11:11.1111119';
Warnings: Warnings:

View File

@ -23,6 +23,14 @@ set global system_versioning_asof= null;
set global system_versioning_asof= 1; set global system_versioning_asof= 1;
--error ER_WRONG_TYPE_FOR_VAR --error ER_WRONG_TYPE_FOR_VAR
set global system_versioning_asof= 1.1; set global system_versioning_asof= 1.1;
--error ER_WRONG_VALUE_FOR_VAR
set global system_versioning_asof= '2011-02-29 00:00';
--error ER_WRONG_VALUE_FOR_VAR
set global system_versioning_asof= '2011-02-28 24:00';
--error ER_WRONG_VALUE_FOR_VAR
set global system_versioning_asof= '2011-00-28 00:00';
--error ER_WRONG_VALUE_FOR_VAR
set global system_versioning_asof= '0000-00-00 00:00';
# session # session
--error ER_WRONG_VALUE_FOR_VAR --error ER_WRONG_VALUE_FOR_VAR
@ -33,6 +41,14 @@ set system_versioning_asof= null;
set system_versioning_asof= 1; set system_versioning_asof= 1;
--error ER_WRONG_TYPE_FOR_VAR --error ER_WRONG_TYPE_FOR_VAR
set system_versioning_asof= 1.1; set system_versioning_asof= 1.1;
--error ER_WRONG_VALUE_FOR_VAR
set system_versioning_asof= '2011-02-29 00:00';
--error ER_WRONG_VALUE_FOR_VAR
set system_versioning_asof= '2011-02-28 24:00';
--error ER_WRONG_VALUE_FOR_VAR
set system_versioning_asof= '2011-00-28 00:00';
--error ER_WRONG_VALUE_FOR_VAR
set system_versioning_asof= '0000-00-00 00:00';
--echo # GLOBAL @@system_versioning_asof --echo # GLOBAL @@system_versioning_asof
set global system_versioning_asof= '1911-11-11 11:11:11.1111119'; set global system_versioning_asof= '1911-11-11 11:11:11.1111119';

View File

@ -2634,7 +2634,10 @@ public:
if (!Sys_var_enum::do_check(thd, var)) if (!Sys_var_enum::do_check(thd, var))
return false; return false;
MYSQL_TIME ltime; MYSQL_TIME ltime;
Datetime::Options opt(TIME_CONV_NONE, thd); // FIXME: please resolve both conflicts to "old" and remove this comment
Datetime::Options opt(TIME_CONV_NONE |
TIME_NO_ZERO_IN_DATE |
TIME_NO_ZERO_DATE, thd);
bool res= var->value->get_date(thd, &ltime, opt); bool res= var->value->get_date(thd, &ltime, opt);
if (!res) if (!res)
{ {
@ -2653,7 +2656,9 @@ private:
if (var->value) if (var->value)
{ {
THD *thd= current_thd; THD *thd= current_thd;
Datetime::Options opt(TIME_CONV_NONE, thd); Datetime::Options opt(TIME_CONV_NONE |
TIME_NO_ZERO_IN_DATE |
TIME_NO_ZERO_DATE, thd);
res= var->value->get_date(thd, &out.ltime, opt); res= var->value->get_date(thd, &out.ltime, opt);
} }
else // set DEFAULT from global var else // set DEFAULT from global var