From 335bfb342119ef97b9b24e5f310f0a55f49e950e Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Mon, 23 Oct 2017 20:15:38 +0300 Subject: [PATCH] Tests: view.test combinations --- mysql-test/suite/versioning/r/view.result | 28 ++++++++----------- .../suite/versioning/t/view.combinations | 5 ++++ mysql-test/suite/versioning/t/view.test | 19 +++++++------ 3 files changed, 28 insertions(+), 24 deletions(-) create mode 100644 mysql-test/suite/versioning/t/view.combinations diff --git a/mysql-test/suite/versioning/r/view.result b/mysql-test/suite/versioning/r/view.result index 9ca5bbc1300..aab433d4c0d 100644 --- a/mysql-test/suite/versioning/r/view.result +++ b/mysql-test/suite/versioning/r/view.result @@ -73,7 +73,7 @@ prepare stmt from concat(a, b, c); execute stmt; deallocate prepare stmt; end~~ -create or replace table t1 (x int) with system versioning engine innodb; +create or replace table t1 (x int) with system versioning; insert into t1 values (1); select now(6) into @t1; update t1 set x= 2; @@ -98,7 +98,7 @@ x create or replace view vt1 as select * from t1; show create view vt1; View Create View character_set_client collation_connection -vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from `t1` FOR SYSTEM_TIME ALL where `t1`.`sys_trx_end` = 18446744073709551615 latin1 latin1_swedish_ci +vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from `t1` FOR SYSTEM_TIME ALL where `t1`.`sys_trx_end` = MAX_RESULT latin1 latin1_swedish_ci drop view vt1; drop view vt2; create view vt1 as select * from t1 for system_time all; @@ -173,9 +173,12 @@ x # VIEW with parameters [#151] create or replace table t1 (x int) with system versioning; create or replace view vt1(c) as select x from t1; +show create view vt1; +View Create View character_set_client collation_connection +vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`x` AS `c`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from `t1` FOR SYSTEM_TIME ALL where `t1`.`sys_trx_end` = MAX_RESULT latin1 latin1_swedish_ci # VIEW over JOIN of versioned tables [#153] -create or replace table t1 (a int) with system versioning engine innodb; -create or replace table t2 (b int) with system versioning engine innodb; +create or replace table t1 (a int) with system versioning; +create or replace table t2 (b int) with system versioning; insert into t1 values (1); insert into t2 values (2); create or replace view vt12 as select * from t1 cross join t2; @@ -194,15 +197,15 @@ create or replace table t3 (x int); create or replace view vt1 as select * from t1, t2, t3; show create view vt1; View Create View character_set_client collation_connection -vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t3`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from ((`t1` FOR SYSTEM_TIME ALL join `t2` FOR SYSTEM_TIME ALL) join `t3`) where `t1`.`sys_trx_end` = 18446744073709551615 and `t2`.`sys_trx_end` = 18446744073709551615 latin1 latin1_swedish_ci +vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`b` AS `b`,`t3`.`x` AS `x`,`t1`.`sys_trx_start` AS `sys_trx_start`,`t1`.`sys_trx_end` AS `sys_trx_end` from ((`t1` FOR SYSTEM_TIME ALL join `t2` FOR SYSTEM_TIME ALL) join `t3`) where `t1`.`sys_trx_end` = MAX_RESULT and `t2`.`sys_trx_end` = MAX_RESULT latin1 latin1_swedish_ci create or replace view vt1 as select * from t3, t2, t1; show create view vt1; View Create View character_set_client collation_connection -vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t3`.`x` AS `x`,`t2`.`b` AS `b`,`t1`.`a` AS `a`,`t2`.`sys_trx_start` AS `sys_trx_start`,`t2`.`sys_trx_end` AS `sys_trx_end` from ((`t3` join `t2` FOR SYSTEM_TIME ALL) join `t1` FOR SYSTEM_TIME ALL) where `t2`.`sys_trx_end` = 18446744073709551615 and `t1`.`sys_trx_end` = 18446744073709551615 latin1 latin1_swedish_ci +vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t3`.`x` AS `x`,`t2`.`b` AS `b`,`t1`.`a` AS `a`,`t2`.`sys_trx_start` AS `sys_trx_start`,`t2`.`sys_trx_end` AS `sys_trx_end` from ((`t3` join `t2` FOR SYSTEM_TIME ALL) join `t1` FOR SYSTEM_TIME ALL) where `t2`.`sys_trx_end` = MAX_RESULT and `t1`.`sys_trx_end` = MAX_RESULT latin1 latin1_swedish_ci create or replace view vt1 as select a, t2.sys_trx_end as endo from t3, t1, t2; show create view vt1; View Create View character_set_client collation_connection -vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`sys_trx_end` AS `endo`,`t2`.`sys_trx_start` AS `sys_trx_start` from ((`t3` join `t1` FOR SYSTEM_TIME ALL) join `t2` FOR SYSTEM_TIME ALL) where `t1`.`sys_trx_end` = 18446744073709551615 and `t2`.`sys_trx_end` = 18446744073709551615 latin1 latin1_swedish_ci +vt1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vt1` AS select `t1`.`a` AS `a`,`t2`.`sys_trx_end` AS `endo`,`t2`.`sys_trx_start` AS `sys_trx_start` from ((`t3` join `t1` FOR SYSTEM_TIME ALL) join `t2` FOR SYSTEM_TIME ALL) where `t1`.`sys_trx_end` = MAX_RESULT and `t2`.`sys_trx_end` = MAX_RESULT latin1 latin1_swedish_ci # VIEW over UNION [#269] create or replace view vt1 as select * from t1 union select * from t1; select * from vt1; @@ -210,12 +213,5 @@ a 1 create or replace view vvt1 as select * from t1, t2, vt1; ERROR HY000: Creating VIEW `vvt1` is prohibited: versioned VIEW `vt1` in query! -drop view vt1, vt12; -drop table t1, t2, t3; -drop procedure verify_vtq; -drop procedure innodb_verify_vtq; -drop function default_engine; -drop function sys_commit_ts; -drop function sys_datatype; -drop procedure concat_exec2; -drop procedure concat_exec3; +drop database test; +create database test; diff --git a/mysql-test/suite/versioning/t/view.combinations b/mysql-test/suite/versioning/t/view.combinations new file mode 100644 index 00000000000..75fb20d9f5e --- /dev/null +++ b/mysql-test/suite/versioning/t/view.combinations @@ -0,0 +1,5 @@ +[innodb] +default-storage-engine=innodb + +[myisam] +default-storage-engine=myisam diff --git a/mysql-test/suite/versioning/t/view.test b/mysql-test/suite/versioning/t/view.test index 9cfe802446f..c48ebef8fa5 100644 --- a/mysql-test/suite/versioning/t/view.test +++ b/mysql-test/suite/versioning/t/view.test @@ -1,7 +1,6 @@ --- source include/have_innodb.inc -- source suite/versioning/common.inc -create or replace table t1 (x int) with system versioning engine innodb; +create or replace table t1 (x int) with system versioning; insert into t1 values (1); select now(6) into @t1; @@ -21,6 +20,7 @@ select * from vt2 for system_time all; select * from t1; create or replace view vt1 as select * from t1; +--replace_result 18446744073709551615 MAX_RESULT "TIMESTAMP'2038-01-19 03:14:07.999999'" MAX_RESULT show create view vt1; drop view vt1; @@ -63,10 +63,12 @@ select * from vt1 for system_time all; --echo # VIEW with parameters [#151] create or replace table t1 (x int) with system versioning; create or replace view vt1(c) as select x from t1; +--replace_result 18446744073709551615 MAX_RESULT "TIMESTAMP'2038-01-19 03:14:07.999999'" MAX_RESULT +show create view vt1; --echo # VIEW over JOIN of versioned tables [#153] -create or replace table t1 (a int) with system versioning engine innodb; -create or replace table t2 (b int) with system versioning engine innodb; +create or replace table t1 (a int) with system versioning; +create or replace table t2 (b int) with system versioning; insert into t1 values (1); insert into t2 values (2); create or replace view vt12 as select * from t1 cross join t2; @@ -82,10 +84,13 @@ create or replace view vt1 as select a, t1.sys_trx_end, t2.sys_trx_end from t1, create or replace table t3 (x int); create or replace view vt1 as select * from t1, t2, t3; +--replace_result 18446744073709551615 MAX_RESULT "TIMESTAMP'2038-01-19 03:14:07.999999'" MAX_RESULT show create view vt1; create or replace view vt1 as select * from t3, t2, t1; +--replace_result 18446744073709551615 MAX_RESULT "TIMESTAMP'2038-01-19 03:14:07.999999'" MAX_RESULT show create view vt1; create or replace view vt1 as select a, t2.sys_trx_end as endo from t3, t1, t2; +--replace_result 18446744073709551615 MAX_RESULT "TIMESTAMP'2038-01-19 03:14:07.999999'" MAX_RESULT show create view vt1; --echo # VIEW over UNION [#269] @@ -95,7 +100,5 @@ select * from 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; - --- source suite/versioning/common_finish.inc +drop database test; +create database test;