summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/versioning/t/autoinc.test
blob: 7c87c17301a200b02f4bc91c33a15001755aa49a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
-- source suite/versioning/engines.inc
-- source suite/versioning/common.inc

--replace_result $sys_datatype_expl SYS_DATATYPE
eval create table t1(
    id int unsigned auto_increment primary key,
    x int unsigned,
    y int unsigned,
    sys_start $sys_datatype_expl as row start invisible,
    sys_end $sys_datatype_expl as row end invisible,
    period for system_time (sys_start, sys_end))
  with system versioning;

eval create table t2(
    id int unsigned auto_increment primary key,
    x int unsigned,
    y int unsigned);

insert into t1(x, y) values(1, 11);
insert into t2(x, y) values(1, 11);
insert into t1(x, y) values(2, 12);
insert into t2(x, y) values(2, 12);
insert into t1(x, y) values(3, 13);
insert into t2(x, y) values(3, 13);
insert into t1(x, y) values(4, 14);
insert into t2(x, y) values(4, 14);
insert into t1(x, y) values(5, 15);
insert into t2(x, y) values(5, 15);
insert into t1(x, y) values(6, 16);
insert into t2(x, y) values(6, 16);
insert into t1(x, y) values(7, 17);
insert into t2(x, y) values(7, 17);
insert into t1(x, y) values(8, 18);
insert into t2(x, y) values(8, 18);
insert into t1(x, y) values(9, 19);
insert into t2(x, y) values(9, 19);

select t1.x = t2.x and t1.y = t2.y as A, t1.x, t1.y, t2.x, t2.y from t1 inner join t2 on t1.id = t2.id;
delete from t1 where x = 2;
delete from t2 where x = 2;

select t1.x = t2.x and t1.y = t2.y as A, t1.x, t1.y, t2.x, t2.y from t1 inner join t2 on t1.id = t2.id;
delete from t1 where x > 7;
delete from t2 where x > 7;

select t1.x = t2.x and t1.y = t2.y as A, t1.x, t1.y, t2.x, t2.y from t1 inner join t2 on t1.id = t2.id;
drop table t1;
drop table t2;

--echo #
--echo # MDEV-22562 Assertion `next_insert_id == 0' upon UPDATE on system-versioned table
--echo #
create table t1 (pk integer auto_increment primary key) engine=myisam with system versioning;
insert delayed into t1 (pk) values (1);
lock tables t1 write;
update t1 set pk= 0;
update t1 set pk= 0;
unlock tables;

# cleanup
drop table t1;

-- source suite/versioning/common_finish.inc