@@ -25,4 +25,60 @@ delete from t1;
2525ERROR HY000: Temporal operation requires `mysql.transaction_registry` (@@system_versioning_transaction_registry).
2626update t1 set x= 3;
2727ERROR HY000: Temporal operation requires `mysql.transaction_registry` (@@system_versioning_transaction_registry).
28+ # ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry
29+ create function check_result (cond boolean)
30+ returns char(50) deterministic
31+ return if(cond = 1, '[CORRECT]', '[INCORRECT]');
32+ set @@system_versioning_alter_history=keep;
33+ set global system_versioning_transaction_registry=on;
34+ Warnings:
35+ Warning 4144 Transaction-based system versioning is EXPERIMENTAL and is subject to change in future.
36+ create or replace table t1 (x int) engine innodb;
37+ insert into t1 values (1);
38+ alter table t1
39+ add column s bigint unsigned as row start,
40+ add column e bigint unsigned as row end,
41+ add period for system_time(s, e),
42+ add system versioning,
43+ algorithm=inplace;
44+ select s from t1 into @trx_start;
45+ select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start;
46+ check_result(count(*) = 1)
47+ [CORRECT]
48+ create or replace table t1 (x int) engine innodb;
49+ select count(*) from mysql.transaction_registry into @tmp;
50+ alter table t1
51+ add column s bigint unsigned as row start,
52+ add column e bigint unsigned as row end,
53+ add period for system_time(s, e),
54+ add system versioning,
55+ algorithm=inplace;
56+ select check_result(count(*) = @tmp) from mysql.transaction_registry;
57+ check_result(count(*) = @tmp)
58+ [CORRECT]
59+ create or replace table t1 (x int) engine innodb;
60+ insert into t1 values (1);
61+ alter table t1
62+ add column s bigint unsigned as row start,
63+ add column e bigint unsigned as row end,
64+ add period for system_time(s, e),
65+ add system versioning,
66+ algorithm=copy;
67+ select s from t1 into @trx_start;
68+ select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start;
69+ check_result(count(*) = 1)
70+ [CORRECT]
71+ create or replace table t1 (x int) engine innodb;
72+ select count(*) from mysql.transaction_registry into @tmp;
73+ alter table t1
74+ add column s bigint unsigned as row start,
75+ add column e bigint unsigned as row end,
76+ add period for system_time(s, e),
77+ add system versioning,
78+ algorithm=copy;
79+ select check_result(count(*) = @tmp) from mysql.transaction_registry;
80+ check_result(count(*) = @tmp)
81+ [CORRECT]
2882drop table t1;
83+ set global system_versioning_transaction_registry=off;
84+ drop function check_result;
0 commit comments