You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

86 lines
2.8 KiB

-- source include/have_innodb.inc
-- source include/not_embedded.inc
select @@system_versioning_transaction_registry;
--error ER_VERS_TRT_IS_DISABLED
create or replace table t1 (
x int,
sys_trx_start bigint(20) unsigned as row start invisible,
sys_trx_end bigint(20) unsigned as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning engine innodb;
set global system_versioning_transaction_registry= 1;
create or replace table t1 (
x int,
sys_trx_start bigint(20) unsigned as row start invisible,
sys_trx_end bigint(20) unsigned as row end invisible,
period for system_time (sys_trx_start, sys_trx_end)
) with system versioning engine innodb;
insert into t1 (x) values (1);
set global system_versioning_transaction_registry= 0;
--error ER_VERS_TRT_IS_DISABLED
insert into t1 (x) values (2);
--error ER_VERS_TRT_IS_DISABLED
delete from t1;
--error ER_VERS_TRT_IS_DISABLED
update t1 set x= 3;
--echo # ALTER ADD SYSTEM VERSIONING should write to mysql.transaction_registry
create function check_result (cond boolean)
returns char(50) deterministic
return if(cond = 1, '[CORRECT]', '[INCORRECT]');
set @@system_versioning_alter_history=keep;
set global system_versioning_transaction_registry=on;
create or replace table t1 (x int) engine innodb;
insert into t1 values (1);
alter table t1
add column s bigint unsigned as row start,
add column e bigint unsigned as row end,
add period for system_time(s, e),
add system versioning,
algorithm=inplace;
select s from t1 into @trx_start;
select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start;
create or replace table t1 (x int) engine innodb;
select count(*) from mysql.transaction_registry into @tmp;
alter table t1
add column s bigint unsigned as row start,
add column e bigint unsigned as row end,
add period for system_time(s, e),
add system versioning,
algorithm=inplace;
select check_result(count(*) = @tmp) from mysql.transaction_registry;
create or replace table t1 (x int) engine innodb;
insert into t1 values (1);
alter table t1
add column s bigint unsigned as row start,
add column e bigint unsigned as row end,
add period for system_time(s, e),
add system versioning,
algorithm=copy;
select s from t1 into @trx_start;
select check_result(count(*) = 1) from mysql.transaction_registry where transaction_id = @trx_start;
create or replace table t1 (x int) engine innodb;
select count(*) from mysql.transaction_registry into @tmp;
alter table t1
add column s bigint unsigned as row start,
add column e bigint unsigned as row end,
add period for system_time(s, e),
add system versioning,
algorithm=copy;
select check_result(count(*) = @tmp) from mysql.transaction_registry;
drop table t1;
set global system_versioning_transaction_registry=off;
drop function check_result;