Skip to content

Commit b615d27

Browse files
committed
MDEV-17798 System variable system_versioning_asof accepts wrong values (10.4)
1 parent 5a6023c commit b615d27

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

mysql-test/suite/versioning/r/sysvars.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ set global system_versioning_asof= 1;
3131
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
3232
set global system_versioning_asof= 1.1;
3333
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
34+
set global system_versioning_asof= '2011-02-29 00:00';
35+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-29 00:00'
36+
set global system_versioning_asof= '2011-02-28 24:00';
37+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-28 24:00'
38+
set global system_versioning_asof= '2011-00-28 00:00';
39+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-00-28 00:00'
40+
set global system_versioning_asof= '0000-00-00 00:00';
41+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '0000-00-00 00:00'
3442
set system_versioning_asof= 'alley';
3543
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of 'alley'
3644
set system_versioning_asof= null;
@@ -39,6 +47,14 @@ set system_versioning_asof= 1;
3947
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
4048
set system_versioning_asof= 1.1;
4149
ERROR 42000: Incorrect argument type to variable 'system_versioning_asof'
50+
set system_versioning_asof= '2011-02-29 00:00';
51+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-29 00:00'
52+
set system_versioning_asof= '2011-02-28 24:00';
53+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-02-28 24:00'
54+
set system_versioning_asof= '2011-00-28 00:00';
55+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '2011-00-28 00:00'
56+
set system_versioning_asof= '0000-00-00 00:00';
57+
ERROR 42000: Variable 'system_versioning_asof' can't be set to the value of '0000-00-00 00:00'
4258
# GLOBAL @@system_versioning_asof
4359
set global system_versioning_asof= '1911-11-11 11:11:11.1111119';
4460
Warnings:

mysql-test/suite/versioning/t/sysvars.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ set global system_versioning_asof= null;
2323
set global system_versioning_asof= 1;
2424
--error ER_WRONG_TYPE_FOR_VAR
2525
set global system_versioning_asof= 1.1;
26+
--error ER_WRONG_VALUE_FOR_VAR
27+
set global system_versioning_asof= '2011-02-29 00:00';
28+
--error ER_WRONG_VALUE_FOR_VAR
29+
set global system_versioning_asof= '2011-02-28 24:00';
30+
--error ER_WRONG_VALUE_FOR_VAR
31+
set global system_versioning_asof= '2011-00-28 00:00';
32+
--error ER_WRONG_VALUE_FOR_VAR
33+
set global system_versioning_asof= '0000-00-00 00:00';
2634

2735
# session
2836
--error ER_WRONG_VALUE_FOR_VAR
@@ -33,6 +41,14 @@ set system_versioning_asof= null;
3341
set system_versioning_asof= 1;
3442
--error ER_WRONG_TYPE_FOR_VAR
3543
set system_versioning_asof= 1.1;
44+
--error ER_WRONG_VALUE_FOR_VAR
45+
set system_versioning_asof= '2011-02-29 00:00';
46+
--error ER_WRONG_VALUE_FOR_VAR
47+
set system_versioning_asof= '2011-02-28 24:00';
48+
--error ER_WRONG_VALUE_FOR_VAR
49+
set system_versioning_asof= '2011-00-28 00:00';
50+
--error ER_WRONG_VALUE_FOR_VAR
51+
set system_versioning_asof= '0000-00-00 00:00';
3652

3753
--echo # GLOBAL @@system_versioning_asof
3854
set global system_versioning_asof= '1911-11-11 11:11:11.1111119';

sql/sys_vars.ic

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,7 +2634,10 @@ public:
26342634
if (!Sys_var_enum::do_check(thd, var))
26352635
return false;
26362636
MYSQL_TIME ltime;
2637-
Datetime::Options opt(TIME_CONV_NONE, thd);
2637+
// FIXME: please resolve both conflicts to "old" and remove this comment
2638+
Datetime::Options opt(TIME_CONV_NONE |
2639+
TIME_NO_ZERO_IN_DATE |
2640+
TIME_NO_ZERO_DATE, thd);
26382641
bool res= var->value->get_date(thd, &ltime, opt);
26392642
if (!res)
26402643
{
@@ -2653,7 +2656,9 @@ private:
26532656
if (var->value)
26542657
{
26552658
THD *thd= current_thd;
2656-
Datetime::Options opt(TIME_CONV_NONE, thd);
2659+
Datetime::Options opt(TIME_CONV_NONE |
2660+
TIME_NO_ZERO_IN_DATE |
2661+
TIME_NO_ZERO_DATE, thd);
26572662
res= var->value->get_date(thd, &out.ltime, opt);
26582663
}
26592664
else // set DEFAULT from global var

0 commit comments

Comments
 (0)