1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-10 23:02:54 +03:00
Files
mariadb/mysql-test/suite/versioning/t/vtmd_show.test
Sergei Golubchik f38ef43013 cleanup: remove *.opt files from the versioning suite
use include/have_xxx.inc when some feature needs to be present
(because --xxx in the opt file will fail if the xxx is not compiled in)

set variables in the test, not on the command line, to avoid unnecessary
server restarts (they're must slower than SET).
2018-02-23 15:33:23 +01:00

93 lines
2.6 KiB
Plaintext

-- source include/have_innodb.inc
delimiter ~~;
create or replace procedure drop_archives (in vtmd_name varchar(64))
begin
declare archive_name varchar(64);
declare cur_done bool default false;
declare cur cursor for
select cur_tmp.archive_name from cur_tmp;
declare continue handler for not found set cur_done = true;
set @tmp= concat('
create or replace temporary table
cur_tmp as
select vtmd.archive_name from ', vtmd_name, '
for system_time all as vtmd
where vtmd.archive_name is not null
group by vtmd.archive_name');
prepare stmt from @tmp; execute stmt; drop prepare stmt;
open cur;
fetch_loop: loop
fetch cur into archive_name;
if cur_done then
leave fetch_loop;
end if;
set @tmp= concat('drop table ', archive_name);
prepare stmt from @tmp; execute stmt; drop prepare stmt;
end loop;
drop table cur_tmp;
end~~
delimiter ;~~
delimiter ~~;
create procedure test_01(in engine varchar(64))
begin
set @tmp = concat('create table t (a int) with system versioning engine ', engine);
prepare stmt from @tmp; execute stmt; drop prepare stmt;
set @tm1 = now(6);
alter table t add column b int;
set @tm2 = now(6);
alter table t add column c int;
show create table t for system_time as of timestamp @tm1;
show create table t for system_time as of timestamp @tm2;
show create table t for system_time as of now;
show create table t for system_time as of timestamp now(6);
show create table t;
set @tm3 = now(6);
rename table t to tt;
show create table tt for system_time as of timestamp @tm3;
set @tm4 = now(6);
alter table tt add column d int;
show create table tt for system_time as of timestamp @tm3;
show create table tt for system_time as of timestamp @tm4;
show create table tt;
drop table tt;
call drop_archives('tt_vtmd');
drop table tt_vtmd;
end~~
delimiter ;~~
create table t (a int) with system versioning;
--error ER_VERS_VTMD_ERROR
show create table t for system_time as of now;
set versioning_alter_history=survive;
create or replace table t (a int) with system versioning;
--error ER_VERS_RANGE_PROHIBITED
show create table t for system_time between timestamp @tm1 and timestamp @tm1;
--error ER_VERS_RANGE_PROHIBITED
show create table t for system_time from timestamp @tm1 to timestamp @tm1;
--error ER_VERS_VTMD_ERROR
show create table t for system_time as of timestamp '01-01-1990';
--error ER_VERS_VTMD_ERROR
show create table t for system_time as of timestamp '01-01-2020';
drop table t;
call drop_archives('t_vtmd');
drop table t_vtmd;
call test_01('myisam');
call test_01('innodb');
drop procedure test_01;
drop procedure drop_archives;