mirror of
https://github.com/MariaDB/server.git
synced 2025-11-28 17:36:30 +03:00
92 lines
3.1 KiB
Plaintext
92 lines
3.1 KiB
Plaintext
-- source include/have_innodb.inc
|
|
|
|
create table t1 (x int) with system versioning engine innodb;
|
|
insert into t1 values (1);
|
|
|
|
select now(6) into @t1;
|
|
update t1 set x= 2;
|
|
|
|
select now(6) into @t2;
|
|
delete from t1;
|
|
|
|
set @vt1= concat("create view vt1 as select * from t1 for system_time as of timestamp '", @t1, "'");
|
|
prepare stmt from @vt1; execute stmt; drop prepare stmt;
|
|
|
|
set @vt2= concat("create view vt2 as select *, sys_trx_end from t1 for system_time as of timestamp '", @t2, "'");
|
|
prepare stmt from @vt2; execute stmt; drop prepare stmt;
|
|
|
|
select * from vt1 for system_time all;
|
|
select * from vt2 for system_time all;
|
|
select * from t1;
|
|
|
|
create or replace view vt1 as select * from t1;
|
|
show create view vt1;
|
|
|
|
drop view vt1;
|
|
drop view vt2;
|
|
|
|
create view vt1 as select * from t1 for system_time all;
|
|
select * from vt1 for system_time all;
|
|
prepare stmt from 'select * from vt1 for system_time all'; execute stmt; drop prepare stmt;
|
|
|
|
select * from vt1;
|
|
prepare stmt from 'select * from vt1'; execute stmt; drop prepare stmt;
|
|
|
|
select * from t1 for system_time as of timestamp @t1;
|
|
select * from vt1 for system_time as of timestamp @t1;
|
|
prepare stmt from 'select * from vt1 for system_time as of timestamp @t1'; execute stmt; drop prepare stmt;
|
|
|
|
create or replace view vt1 as select * from t1;
|
|
select * from vt1 for system_time all;
|
|
prepare stmt from 'select * from vt1 for system_time all'; execute stmt; drop prepare stmt;
|
|
|
|
insert into vt1 values (3);
|
|
select * from t1;
|
|
select * from vt1;
|
|
select * from t1 for system_time all;
|
|
select * from vt1 for system_time all;
|
|
|
|
create or replace table t1 (x int) with system versioning;
|
|
insert into t1 values (1), (2);
|
|
set @t1=now(6);
|
|
delete from t1 where x=2;
|
|
set @t2=now(6);
|
|
delete from t1 where x=1;
|
|
set @t3=now(6);
|
|
|
|
set @tmp= concat("create or replace view vt1 as select * from t1 for system_time as of timestamp '", @t1, "'");
|
|
prepare stmt from @tmp; execute stmt; drop prepare stmt;
|
|
|
|
select * from vt1 for system_time all;
|
|
|
|
create or replace table t1 (x int) with system versioning;
|
|
create or replace view vt1(c) as select x from t1;
|
|
|
|
create or replace table t1 (a int) with system versioning engine innodb;
|
|
create or replace table t2 (b int) with system versioning engine innodb;
|
|
insert into t1 values (1);
|
|
insert into t2 values (2);
|
|
create or replace view vt12 as select * from t1 cross join t2;
|
|
select * from vt12;
|
|
create or replace view vt12 as select * from t1 for system_time as of timestamp '0-0-0' cross join t2;
|
|
select * from vt12;
|
|
|
|
--error ER_VERS_VIEW_PROHIBITED
|
|
create or replace view vt1 as select a, t1.sys_trx_start, t2.sys_trx_end from t1, t2;
|
|
--error ER_VERS_VIEW_PROHIBITED
|
|
create or replace view vt1 as select a, t1.sys_trx_end, t2.sys_trx_end from t1, t2;
|
|
|
|
create or replace table t3 (x int);
|
|
create or replace view vt1 as select * from t1, t2, t3;
|
|
show create view vt1;
|
|
create or replace view vt1 as select * from t3, t2, t1;
|
|
show create view vt1;
|
|
create or replace view vt1 as select a, t2.sys_trx_end as endo from t3, t1, t2;
|
|
show create view vt1;
|
|
|
|
--error ER_VERS_VIEW_PROHIBITED
|
|
create or replace view vvt1 as select * from t1, t2, vt1;
|
|
|
|
drop view vt1, vt12;
|
|
drop table t1, t2, t3;
|