@@ -1390,8 +1391,13 @@ INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
...
@@ -1390,8 +1391,13 @@ INSERT INTO `t2` VALUES ('alfred'),('angie'),('bingo'),('waffle'),('lemon');
UNLOCK TABLES;
UNLOCK TABLES;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
DROP TABLE IF EXISTS `v2`;
DROP TABLE IF EXISTS `v2`;
DROP VIEW IF EXISTS `v2`;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
CREATE ALGORITHM=UNDEFINED VIEW `db1`.`v2` AS select `db1`.`t2`.`a` AS `a` from `db1`.`t2` where (`db1`.`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION;
/*!50001 CREATE TABLE `v2` (
`a` varchar(30) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
...
@@ -1404,6 +1410,33 @@ CREATE ALGORITHM=UNDEFINED VIEW `db1`.`v2` AS select `db1`.`t2`.`a` AS `a` from
...
@@ -1404,6 +1410,33 @@ CREATE ALGORITHM=UNDEFINED VIEW `db1`.`v2` AS select `db1`.`t2`.`a` AS `a` from
drop table t2;
drop table t2;
drop view v2;
drop view v2;
drop database db1;
drop database db1;
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;
drop table t1, t2;
drop view v1, v2;
drop database db2;
create database db1;
use db1;
show tables;
Tables_in_db1
t1
t2
v1
v2
select * from t2 order by a;
a b
1 on
2 off
10 pol
12 meg
drop table t1, t2;
drop database db1;
CREATE DATABASE mysqldump_test_db;
CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
USE mysqldump_test_db;
CREATE TABLE t1 ( a INT );
CREATE TABLE t1 ( a INT );
...
@@ -1598,7 +1631,7 @@ DROP TABLE IF EXISTS `v1`;
...
@@ -1598,7 +1631,7 @@ DROP TABLE IF EXISTS `v1`;
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1`*/;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
...
@@ -1650,7 +1683,7 @@ DROP TABLE IF EXISTS `v2`;
...
@@ -1650,7 +1683,7 @@ DROP TABLE IF EXISTS `v2`;
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
) ENGINE=MyISAM DEFAULT CHARSET=latin1*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `mysqldump_test_db`.`v2` AS select `mysqldump_test_db`.`t2`.`a` AS `a` from `mysqldump_test_db`.`t2` where (`mysqldump_test_db`.`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!50001 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where (`t2`.`a` like _latin1'a%') WITH CASCADED CHECK OPTION*/;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
...
@@ -1714,7 +1747,7 @@ v2 VIEW
...
@@ -1714,7 +1747,7 @@ v2 VIEW
v3 VIEW
v3 VIEW
show create view v1;
show create view v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `test`.`v3` where (`v3`.`b` in (1,2,3,4,5,6,7))
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7))
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1`
show create view v1;
show create view v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select (`t1`.`b` + 1) AS `c` from `t1`
show create view t1;
show create view t1;
ERROR HY000: 'test.t1' is not VIEW
ERROR HY000: 'test.t1' is not VIEW
drop table t1;
drop table t1;
...
@@ -55,7 +55,7 @@ Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
...
@@ -55,7 +55,7 @@ Note 1003 select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
create algorithm=temptable view v2 (c) as select b+1 from t1;
create algorithm=temptable view v2 (c) as select b+1 from t1;
show create view v2;
show create view v2;
View Create View
View Create View
v2 CREATE ALGORITHM=TEMPTABLE VIEW `test`.`v2` AS select (`test`.`t1`.`b` + 1) AS `c` from `test`.`t1`
v2 CREATE ALGORITHM=TEMPTABLE VIEW `v2` AS select (`t1`.`b` + 1) AS `c` from `t1`
select c from v2;
select c from v2;
c
c
3
3
...
@@ -550,7 +550,7 @@ create table t1 ("a*b" int);
...
@@ -550,7 +550,7 @@ create table t1 ("a*b" int);
create view v1 as select "a*b" from t1;
create view v1 as select "a*b" from t1;
show create view v1;
show create view v1;
View Create View
View Create View
v1 CREATE VIEW "test"."v1" AS select "test"."t1"."a*b" AS "a*b" from "test"."t1"
v1 CREATE VIEW "v1" AS select "t1"."a*b" AS "a*b" from "t1"
drop view v1;
drop view v1;
drop table t1;
drop table t1;
set sql_mode=default;
set sql_mode=default;
...
@@ -657,7 +657,7 @@ drop table t1;
...
@@ -657,7 +657,7 @@ drop table t1;
CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version();
CREATE VIEW v1 (f1,f2,f3,f4) AS SELECT connection_id(), pi(), current_user(), version();
SHOW CREATE VIEW v1;
SHOW CREATE VIEW v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select sql_no_cache connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4`
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache connection_id() AS `f1`,pi() AS `f2`,current_user() AS `f3`,version() AS `f4`
drop view v1;
drop view v1;
create table t1 (s1 int);
create table t1 (s1 int);
create table t2 (s2 int);
create table t2 (s2 int);
...
@@ -691,13 +691,13 @@ create view v1 as select a from t1;
...
@@ -691,13 +691,13 @@ create view v1 as select a from t1;
create view v2 as select a from t2 where a in (select a from v1);
create view v2 as select a from t2 where a in (select a from v1);
show create view v2;
show create view v2;
View Create View
View Create View
v2 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v2` AS select `test`.`t2`.`a` AS `a` from `test`.`t2` where `a` in (select `v1`.`a` AS `a` from `test`.`v1`)
v2 CREATE ALGORITHM=UNDEFINED VIEW `v2` AS select `t2`.`a` AS `a` from `t2` where `a` in (select `v1`.`a` AS `a` from `v1`)
drop view v2, v1;
drop view v2, v1;
drop table t1, t2;
drop table t1, t2;
CREATE VIEW `v 1` AS select 5 AS `5`;
CREATE VIEW `v 1` AS select 5 AS `5`;
show create view `v 1`;
show create view `v 1`;
View Create View
View Create View
v 1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v 1` AS select 5 AS `5`
v 1 CREATE ALGORITHM=UNDEFINED VIEW `v 1` AS select 5 AS `5`
drop view `v 1`;
drop view `v 1`;
create database mysqltest;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create table mysqltest.t1 (a int, b int);
...
@@ -765,14 +765,14 @@ a b
...
@@ -765,14 +765,14 @@ a b
1 1
1 1
show create view v3;
show create view v3;
View Create View
View Create View
v3 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`test`.`v1` join `test`.`v2`) where (`v1`.`col1` = `v2`.`col1`)
v3 CREATE ALGORITHM=UNDEFINED VIEW `v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from (`v1` join `v2`) where (`v1`.`col1` = `v2`.`col1`)
drop view v3, v2, v1;
drop view v3, v2, v1;
drop table t2, t1;
drop table t2, t1;
create function `f``1` () returns int return 5;
create function `f``1` () returns int return 5;
create view v1 as select test.`f``1` ();
create view v1 as select test.`f``1` ();
show create view v1;
show create view v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select sql_no_cache `test`.`f``1`() AS `test.``f````1`` ()`
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `test`.`f``1`() AS `test.``f````1`` ()`
create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now();
create view v1 as select a,b,t1.a < now() from t1,t2 where t1.a < now();
SHOW CREATE VIEW v1;
SHOW CREATE VIEW v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select sql_no_cache `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b`,(`test`.`t1`.`a` < now()) AS `t1.a < now()` from (`test`.`t1` join `test`.`t2`) where (`test`.`t1`.`a` < now())
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `t1`.`a` AS `a`,`t2`.`b` AS `b`,(`t1`.`a` < now()) AS `t1.a < now()` from (`t1` join `t2`) where (`t1`.`a` < now())
drop view v1;
drop view v1;
drop table t1, t2;
drop table t1, t2;
CREATE TABLE t1 ( a varchar(50) );
CREATE TABLE t1 ( a varchar(50) );
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = CURRENT_USER();
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = CURRENT_USER();
SHOW CREATE VIEW v1;
SHOW CREATE VIEW v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select sql_no_cache `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = current_user())
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `t1`.`a` AS `a` from `t1` where (`t1`.`a` = current_user())
DROP VIEW v1;
DROP VIEW v1;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION();
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = VERSION();
SHOW CREATE VIEW v1;
SHOW CREATE VIEW v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = version())
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select `t1`.`a` AS `a` from `t1` where (`t1`.`a` = version())
DROP VIEW v1;
DROP VIEW v1;
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE();
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a = DATABASE();
SHOW CREATE VIEW v1;
SHOW CREATE VIEW v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select sql_no_cache `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = database())
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select sql_no_cache `t1`.`a` AS `a` from `t1` where (`t1`.`a` = database())
DROP VIEW v1;
DROP VIEW v1;
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (col1 time);
CREATE TABLE t1 (col1 time);
...
@@ -1949,7 +1949,7 @@ create table t1 (s1 int);
...
@@ -1949,7 +1949,7 @@ create table t1 (s1 int);
create view v1 as select var_samp(s1) from t1;
create view v1 as select var_samp(s1) from t1;
show create view v1;
show create view v1;
View Create View
View Create View
v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select var_samp(`test`.`t1`.`s1`) AS `var_samp(s1)` from `test`.`t1`
v1 CREATE ALGORITHM=UNDEFINED VIEW `v1` AS select var_samp(`t1`.`s1`) AS `var_samp(s1)` from `t1`