Skip to content

Commit 57f7b48

Browse files
committed
MDEV-16937 Strict SQL with system versioned tables causes issues (10.4)
Respect system fields in NO_ZERO_DATE mode. This is the subject for refactoring in MDEV-19597 Conflict resolution from 7d52233
1 parent 278face commit 57f7b48

18 files changed

+68
-33
lines changed

mysql-test/suite/federated/federatedx_versioning.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ show create table tf;
99
Table Create Table
1010
tf CREATE TABLE `tf` (
1111
`x` int(11) DEFAULT NULL,
12-
`row_start` SYS_TYPE NOT NULL INVISIBLE DEFAULT 0,
13-
`row_end` SYS_TYPE NOT NULL INVISIBLE DEFAULT 0
12+
`row_start` SYS_TYPE INVISIBLE DEFAULT '1971-01-01 00:00:00.000000',
13+
`row_end` SYS_TYPE INVISIBLE DEFAULT '1971-01-01 00:00:00.000000'
1414
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1'
1515
# INSERT
1616
insert into t1 values (1);

mysql-test/suite/federated/federatedx_versioning.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ eval create or replace table t1 (
1212
with system versioning;
1313
--replace_result $MASTER_MYPORT MASTER_MYPORT
1414
eval create or replace table tf engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1';
15-
--replace_result $MASTER_MYPORT MASTER_MYPORT $sys_datatype_expl SYS_TYPE "'0000-00-00 00:00:00.000000'" 0
15+
--replace_result $MASTER_MYPORT MASTER_MYPORT $sys_datatype_expl SYS_TYPE 19710101000000 "'1971-01-01 00:00:00.000000'" " NOT NULL" ""
1616
show create table tf;
1717
--echo # INSERT
1818
insert into t1 values (1);

mysql-test/suite/versioning/common.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ if ($MTR_COMBINATION_MYISAM)
5050
{
5151
--let $MTR_COMBINATION_TIMESTAMP= 1
5252
}
53+
if ($MTR_COMBINATION_TRADITIONAL)
54+
{
55+
--let $MTR_COMBINATION_TIMESTAMP= 1
56+
}
5357
if ($MTR_COMBINATION_HEAP)
5458
{
5559
--let $MTR_COMBINATION_TIMESTAMP= 1

mysql-test/suite/versioning/engines.combinations

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,10 @@ default-storage-engine=innodb
77
[myisam]
88
default-storage-engine=myisam
99

10+
[traditional]
11+
default-storage-engine=myisam
12+
sql-mode=traditional
13+
1014
[heap]
1115
default-storage-engine=memory
16+

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ASOF_x y
4545
7 107
4646
8 108
4747
9 109
48-
select x as FROMTO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
48+
select x as FROMTO_x, y from t1 for system_time from timestamp '1970-01-01 00:00:00' to timestamp @t1;
4949
FROMTO_x y
5050
0 100
5151
1 101
@@ -57,7 +57,7 @@ FROMTO_x y
5757
7 107
5858
8 108
5959
9 109
60-
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
60+
select x as BETWAND_x, y from t1 for system_time between timestamp '1970-01-01 00:00:00' and timestamp @t1;
6161
BETWAND_x y
6262
0 100
6363
1 101
@@ -284,7 +284,7 @@ a b
284284
select * from (select * from (select * from t1 cross join t2) as tmp1) as tmp2;
285285
a b
286286
1 2
287-
select * from (select * from t1 cross join t2 for system_time as of timestamp ('0-0-0')) as tmp;
287+
select * from (select * from t1 cross join t2 for system_time as of timestamp ('1970-01-01 00:00:00')) as tmp;
288288
a b
289289
create or replace table t1(a1 int) with system versioning;
290290
create or replace table t2(a2 int) with system versioning;

mysql-test/suite/versioning/r/select2,trx_id.rdiff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
7 107
2323
8 108
2424
9 109
25-
-select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
25+
-select x as FROMTO2_x, y from t1 for system_time from '1970-01-01 00:00' to @t1;
2626
+select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
2727
FROMTO2_x y
2828
0 100
@@ -31,7 +31,7 @@
3131
7 107
3232
8 108
3333
9 109
34-
-select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
34+
-select x as BETWAND2_x, y from t1 for system_time between timestamp '1970-01-01 00:00' and timestamp @t1;
3535
+select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
3636
BETWAND2_x y
3737
0 100

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ASOF_x y
4848
7 107
4949
8 108
5050
9 109
51-
select x as FROMTO_x, y from t1 for system_time from '0-0-0 0:0:0' to timestamp @t1;
51+
select x as FROMTO_x, y from t1 for system_time from '1970-01-01 00:00' to timestamp @t1;
5252
FROMTO_x y
5353
0 100
5454
1 101
@@ -60,7 +60,7 @@ FROMTO_x y
6060
7 107
6161
8 108
6262
9 109
63-
select x as BETWAND_x, y from t1 for system_time between '0-0-0 0:0:0' and timestamp @t1;
63+
select x as BETWAND_x, y from t1 for system_time between '1970-01-01 00:00' and timestamp @t1;
6464
BETWAND_x y
6565
0 100
6666
1 101
@@ -98,7 +98,7 @@ ASOF2_x y
9898
7 107
9999
8 108
100100
9 109
101-
select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
101+
select x as FROMTO2_x, y from t1 for system_time from '1970-01-01 00:00' to @t1;
102102
FROMTO2_x y
103103
0 100
104104
1 101
@@ -110,7 +110,7 @@ FROMTO2_x y
110110
7 107
111111
8 108
112112
9 109
113-
select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
113+
select x as BETWAND2_x, y from t1 for system_time between timestamp '1970-01-01 00:00' and timestamp @t1;
114114
BETWAND2_x y
115115
0 100
116116
1 101
@@ -275,7 +275,7 @@ a b
275275
select * from (select * from (select * from t1 cross join t2) as tmp1) as tmp2;
276276
a b
277277
1 2
278-
select * from (select * from t1 cross join t2 for system_time as of timestamp ('0-0-0')) as tmp;
278+
select * from (select * from t1 cross join t2 for system_time as of timestamp ('1970-01-01 00:00')) as tmp;
279279
a b
280280
create or replace table t1(a1 int) with system versioning;
281281
create or replace table t2(a2 int) with system versioning;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ select * from t for system_time all;
134134
a
135135
2
136136
1
137-
select * from t for system_time from '0-0-0' to current_timestamp(6);
137+
select * from t for system_time from '1970-01-01 00:00' to current_timestamp(6);
138138
a
139139
2
140140
1
141-
select * from t for system_time between '0-0-0' and current_timestamp(6);
141+
select * from t for system_time between '1970-01-01 00:00' and current_timestamp(6);
142142
a
143143
2
144144
1

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ create or replace view vt12 as select * from t1 cross join t2;
7979
select * from vt12;
8080
a b
8181
1 2
82-
create or replace view vt12 as select * from t1 for system_time as of timestamp ('0-0-0') cross join t2;
82+
create or replace view vt12 as select * from t1 for system_time as of timestamp ('1970-01-01 00:00') cross join t2;
8383
select * from vt12;
8484
a b
8585
# VIEW improvements [tempesta-tech/mariadb#183]

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ if ($MTR_COMBINATION_TRX_ID)
4848

4949
select x, y from t1;
5050
select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
51-
select x as FROMTO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
52-
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
51+
select x as FROMTO_x, y from t1 for system_time from timestamp '1970-01-01 00:00:00' to timestamp @t1;
52+
select x as BETWAND_x, y from t1 for system_time between timestamp '1970-01-01 00:00:00' and timestamp @t1;
5353
select x as ALL_x, y from t1 for system_time all;
5454

5555
--disable_query_log
@@ -62,8 +62,8 @@ if ($MTR_COMBINATION_TRX_ID)
6262
if ($MTR_COMBINATION_TIMESTAMP)
6363
{
6464
select x as ASOF2_x, y from t1 for system_time as of @t0;
65-
select x as FROMTO2_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
66-
select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
65+
select x as FROMTO2_x, y from t1 for system_time from timestamp '1970-01-01 00:00:00' to timestamp @t1;
66+
select x as BETWAND2_x, y from t1 for system_time between timestamp '1970-01-01 00:00:00' and timestamp @t1;
6767
}
6868
--enable_query_log
6969

@@ -186,7 +186,7 @@ insert into t1 values (1);
186186
insert into t2 values (2);
187187
select * from (select * from t1 cross join t2) as tmp;
188188
select * from (select * from (select * from t1 cross join t2) as tmp1) as tmp2;
189-
select * from (select * from t1 cross join t2 for system_time as of timestamp ('0-0-0')) as tmp;
189+
select * from (select * from t1 cross join t2 for system_time as of timestamp ('1970-01-01 00:00:00')) as tmp;
190190

191191
create or replace table t1(a1 int) with system versioning;
192192
create or replace table t2(a2 int) with system versioning;

0 commit comments

Comments
 (0)