1drop table if exists t1Aa,t2Aa,v1Aa,v2Aa; 2drop view if exists t1Aa,t2Aa,v1Aa,v2Aa; 3drop database if exists MySQLTest; 4create database MySQLTest; 5use MySQLTest; 6create table TaB (Field int); 7create view ViE as select * from TAb; 8show create table VIe; 9View Create View character_set_client collation_connection 10vie CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vie` AS select `tab`.`Field` AS `Field` from `tab` latin1 latin1_swedish_ci 11drop database MySQLTest; 12use test; 13create table t1Aa (col1 int); 14create table t2aA (col1 int); 15create view v1Aa as select * from t1aA; 16create view v2aA as select * from v1aA; 17create view v3Aa as select v2Aa.col1 from v2aA,t2Aa where v2Aa.col1 = t2aA.col1; 18update v2aA set col1 = (select max(col1) from v1Aa); 19ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 'v2aA'. 20update v2Aa set col1 = (select max(col1) from t1Aa); 21ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v2Aa'. 22update v2aA set col1 = (select max(col1) from v2Aa); 23ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause 24update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v1aA) where v2aA.col1 = t2aA.col1; 25ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v2aA'. 26update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v1Aa) where t1aA.col1 = t2aA.col1; 27ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't1aA'. 28update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1; 29ERROR HY000: You can't specify target table 'v1aA' for update in FROM clause 30update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from v1aA) where v2Aa.col1 = t2aA.col1; 31ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'. 32update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v1Aa) where t1Aa.col1 = t2aA.col1; 33ERROR HY000: The definition of table 'v1Aa' prevents operation UPDATE on table 't2Aa'. 34update t2Aa,v1aA set v1Aa.col1 = (select max(col1) from v1aA) where v1Aa.col1 = t2aA.col1; 35ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 't2Aa'. 36update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from t1aA) where v2aA.col1 = t2aA.col1; 37ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v2aA'. 38update t1Aa,t2Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1; 39ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause 40update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from t1Aa) where v1aA.col1 = t2aA.col1; 41ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v1aA'. 42update t2Aa,v2Aa set v2aA.col1 = (select max(col1) from t1aA) where v2Aa.col1 = t2aA.col1; 43ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause 44update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from t1Aa) where t1aA.col1 = t2aA.col1; 45ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause 46update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from t1Aa) where v1Aa.col1 = t2aA.col1; 47ERROR HY000: You can't specify target table 't2Aa' for update in FROM clause 48update v2aA,t2Aa set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1; 49ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause 50update t1aA,t2Aa set t1Aa.col1 = (select max(col1) from v2aA) where t1aA.col1 = t2aA.col1; 51ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't1aA'. 52update v1aA,t2Aa set v1Aa.col1 = (select max(col1) from v2Aa) where v1aA.col1 = t2aA.col1; 53ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 'v1aA'. 54update t2Aa,v2aA set v2Aa.col1 = (select max(col1) from v2aA) where v2Aa.col1 = t2aA.col1; 55ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'. 56update t2Aa,t1Aa set t1aA.col1 = (select max(col1) from v2aA) where t1Aa.col1 = t2aA.col1; 57ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 't2Aa'. 58update t2Aa,v1Aa set v1aA.col1 = (select max(col1) from v2Aa) where v1Aa.col1 = t2aA.col1; 59ERROR HY000: The definition of table 'v2Aa' prevents operation UPDATE on table 't2Aa'. 60update v3aA set v3Aa.col1 = (select max(col1) from v1aA); 61ERROR HY000: The definition of table 'v1aA' prevents operation UPDATE on table 'v3aA'. 62update v3aA set v3Aa.col1 = (select max(col1) from t1aA); 63ERROR HY000: The definition of table 'v3aA' prevents operation UPDATE on table 'v3aA'. 64update v3aA set v3Aa.col1 = (select max(col1) from v2aA); 65ERROR HY000: The definition of table 'v2aA' prevents operation UPDATE on table 'v3aA'. 66update v3aA set v3Aa.col1 = (select max(col1) from v3aA); 67ERROR HY000: You can't specify target table 'v3aA' for update in FROM clause 68delete from v2Aa where col1 = (select max(col1) from v1Aa); 69ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v2Aa'. 70delete from v2aA where col1 = (select max(col1) from t1Aa); 71ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v2aA'. 72delete from v2Aa where col1 = (select max(col1) from v2aA); 73ERROR HY000: You can't specify target table 'v2Aa' for update in FROM clause 74delete v2Aa from v2aA,t2Aa where (select max(col1) from v1aA) > 0 and v2Aa.col1 = t2aA.col1; 75ERROR HY000: The definition of table 'v1aA' prevents operation DELETE on table 'v2aA'. 76delete t1aA from t1Aa,t2Aa where (select max(col1) from v1Aa) > 0 and t1aA.col1 = t2aA.col1; 77ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 't1Aa'. 78delete v1aA from v1Aa,t2Aa where (select max(col1) from v1aA) > 0 and v1Aa.col1 = t2aA.col1; 79ERROR HY000: You can't specify target table 'v1Aa' for update in FROM clause 80delete v2aA from v2Aa,t2Aa where (select max(col1) from t1Aa) > 0 and v2aA.col1 = t2aA.col1; 81ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 'v2Aa'. 82delete t1aA from t1Aa,t2Aa where (select max(col1) from t1aA) > 0 and t1Aa.col1 = t2aA.col1; 83ERROR HY000: You can't specify target table 't1Aa' for update in FROM clause 84delete v1aA from v1Aa,t2Aa where (select max(col1) from t1aA) > 0 and v1aA.col1 = t2aA.col1; 85ERROR HY000: The definition of table 'v1Aa' prevents operation DELETE on table 'v1Aa'. 86delete v2Aa from v2aA,t2Aa where (select max(col1) from v2Aa) > 0 and v2aA.col1 = t2aA.col1; 87ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause 88delete t1Aa from t1aA,t2Aa where (select max(col1) from v2Aa) > 0 and t1Aa.col1 = t2aA.col1; 89ERROR HY000: The definition of table 'v2Aa' prevents operation DELETE on table 't1aA'. 90delete v1Aa from v1aA,t2Aa where (select max(col1) from v2aA) > 0 and v1Aa.col1 = t2aA.col1; 91ERROR HY000: The definition of table 'v2aA' prevents operation DELETE on table 'v1aA'. 92insert into v2Aa values ((select max(col1) from v1aA)); 93ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2Aa'. 94insert into t1aA values ((select max(col1) from v1Aa)); 95ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 't1aA'. 96insert into v2aA values ((select max(col1) from v1aA)); 97ERROR HY000: The definition of table 'v1aA' prevents operation INSERT on table 'v2aA'. 98insert into v2Aa values ((select max(col1) from t1Aa)); 99ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 'v2Aa'. 100insert into t1aA values ((select max(col1) from t1Aa)); 101ERROR HY000: You can't specify target table 't1aA' for update in FROM clause 102insert into v2aA values ((select max(col1) from t1aA)); 103ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v2aA'. 104insert into v2Aa values ((select max(col1) from v2aA)); 105ERROR HY000: You can't specify target table 'v2Aa' for update in FROM clause 106insert into t1Aa values ((select max(col1) from v2Aa)); 107ERROR HY000: The definition of table 'v2Aa' prevents operation INSERT on table 't1Aa'. 108insert into v2aA values ((select max(col1) from v2Aa)); 109ERROR HY000: You can't specify target table 'v2aA' for update in FROM clause 110insert into v3Aa (col1) values ((select max(col1) from v1Aa)); 111ERROR HY000: The definition of table 'v1Aa' prevents operation INSERT on table 'v3Aa'. 112insert into v3aA (col1) values ((select max(col1) from t1aA)); 113ERROR HY000: The definition of table 'v3aA' prevents operation INSERT on table 'v3aA'. 114insert into v3Aa (col1) values ((select max(col1) from v2aA)); 115ERROR HY000: The definition of table 'v2aA' prevents operation INSERT on table 'v3Aa'. 116drop view v3aA,v2Aa,v1aA; 117drop table t1Aa,t2Aa; 118create table t1Aa (col1 int); 119create view v1Aa as select col1 from t1Aa as AaA; 120show create view v1AA; 121View Create View character_set_client collation_connection 122v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci 123drop view v1AA; 124select Aaa.col1 from t1Aa as AaA; 125col1 126create view v1Aa as select Aaa.col1 from t1Aa as AaA; 127drop view v1AA; 128create view v1Aa as select AaA.col1 from t1Aa as AaA; 129show create view v1AA; 130View Create View character_set_client collation_connection 131v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci 132drop view v1AA; 133drop table t1Aa; 134CREATE TABLE t1 (a int, b int); 135select X.a from t1 AS X group by X.b having (X.a = 1); 136a 137select X.a from t1 AS X group by X.b having (x.a = 1); 138a 139select X.a from t1 AS X group by X.b having (x.b = 1); 140a 141CREATE OR REPLACE VIEW v1 AS 142select X.a from t1 AS X group by X.b having (X.a = 1); 143SHOW CREATE VIEW v1; 144View Create View character_set_client collation_connection 145v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having (`x`.`a` = 1) latin1 latin1_swedish_ci 146SELECT * FROM v1; 147a 148DROP VIEW v1; 149DROP TABLE t1; 150End of 5.0 tests. 151# 152# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS 153# returns nothing 154# 155CREATE TABLE `ttt` ( 156`f1` char(3) NOT NULL, 157PRIMARY KEY (`f1`) 158)DEFAULT CHARSET=latin1; 159SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 160'TTT'; 161count(COLUMN_NAME) 1621 163SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT'; 164count(*) 1651 166DROP TABLE `ttt`; 167End of 5.0 tests. 168