Loading mysql-test/r/view.result +15 −0 Original line number Diff line number Diff line Loading @@ -2424,3 +2424,18 @@ f1 sum(f2) NULL 12 drop view v1; drop table t1; CREATE VIEW v1 AS SELECT 42 AS Meaning; DROP FUNCTION IF EXISTS f1; CREATE FUNCTION f1() RETURNS INTEGER BEGIN DECLARE retn INTEGER; SELECT Meaning FROM v1 INTO retn; RETURN retn; END // CREATE VIEW v2 AS SELECT f1(); select * from v2; f1() 42 drop view v2,v1; drop function f1; mysql-test/r/view_query_cache.result +61 −0 Original line number Diff line number Diff line Loading @@ -132,4 +132,65 @@ unlock tables; set query_cache_wlock_invalidate=default; drop view v1; drop table t1; flush status; create table t1 (a int, b int); create algorithm=temptable view v1 as select * from t1; select * from v1; a b show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from v1; a b show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 insert into t1 values (1,1); show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 select * from v1; a b 1 1 select * from v1; a b 1 1 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 2 drop view v1; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 2 drop table t1; set GLOBAL query_cache_size=default; mysql-test/t/view.test +21 −0 Original line number Diff line number Diff line Loading @@ -2280,3 +2280,24 @@ create view v1 as select * from t1; select f1, sum(f2) from v1 group by f1; drop view v1; drop table t1; # # BUG#15096: using function with view for view creation # CREATE VIEW v1 AS SELECT 42 AS Meaning; --disable_warnings DROP FUNCTION IF EXISTS f1; --enable_warnings DELIMITER //; CREATE FUNCTION f1() RETURNS INTEGER BEGIN DECLARE retn INTEGER; SELECT Meaning FROM v1 INTO retn; RETURN retn; END // DELIMITER ;// CREATE VIEW v2 AS SELECT f1(); select * from v2; drop view v2,v1; drop function f1; mysql-test/t/view_query_cache.test +31 −0 Original line number Diff line number Diff line Loading @@ -96,4 +96,35 @@ unlock tables; set query_cache_wlock_invalidate=default; drop view v1; drop table t1; # # BUG#15119: returning temptable view from the query cache. # flush status; create table t1 (a int, b int); create algorithm=temptable view v1 as select * from t1; select * from v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; select * from v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; insert into t1 values (1,1); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; select * from v1; select * from v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop view v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; # Reset default environment. set GLOBAL query_cache_size=default; sql/sql_cache.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2184,7 +2184,7 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used, tables_used; tables_used= tables_used->next_global, n++, block_table++) { if (tables_used->derived) if (tables_used->derived && !tables_used->view) { DBUG_PRINT("qcache", ("derived table skipped")); n--; Loading Loading
mysql-test/r/view.result +15 −0 Original line number Diff line number Diff line Loading @@ -2424,3 +2424,18 @@ f1 sum(f2) NULL 12 drop view v1; drop table t1; CREATE VIEW v1 AS SELECT 42 AS Meaning; DROP FUNCTION IF EXISTS f1; CREATE FUNCTION f1() RETURNS INTEGER BEGIN DECLARE retn INTEGER; SELECT Meaning FROM v1 INTO retn; RETURN retn; END // CREATE VIEW v2 AS SELECT f1(); select * from v2; f1() 42 drop view v2,v1; drop function f1;
mysql-test/r/view_query_cache.result +61 −0 Original line number Diff line number Diff line Loading @@ -132,4 +132,65 @@ unlock tables; set query_cache_wlock_invalidate=default; drop view v1; drop table t1; flush status; create table t1 (a int, b int); create algorithm=temptable view v1 as select * from t1; select * from v1; a b show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 0 select * from v1; a b show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 insert into t1 values (1,1); show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value Qcache_hits 1 select * from v1; a b 1 1 select * from v1; a b 1 1 show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 2 drop view v1; show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value Qcache_inserts 2 show status like "Qcache_hits"; Variable_name Value Qcache_hits 2 drop table t1; set GLOBAL query_cache_size=default;
mysql-test/t/view.test +21 −0 Original line number Diff line number Diff line Loading @@ -2280,3 +2280,24 @@ create view v1 as select * from t1; select f1, sum(f2) from v1 group by f1; drop view v1; drop table t1; # # BUG#15096: using function with view for view creation # CREATE VIEW v1 AS SELECT 42 AS Meaning; --disable_warnings DROP FUNCTION IF EXISTS f1; --enable_warnings DELIMITER //; CREATE FUNCTION f1() RETURNS INTEGER BEGIN DECLARE retn INTEGER; SELECT Meaning FROM v1 INTO retn; RETURN retn; END // DELIMITER ;// CREATE VIEW v2 AS SELECT f1(); select * from v2; drop view v2,v1; drop function f1;
mysql-test/t/view_query_cache.test +31 −0 Original line number Diff line number Diff line Loading @@ -96,4 +96,35 @@ unlock tables; set query_cache_wlock_invalidate=default; drop view v1; drop table t1; # # BUG#15119: returning temptable view from the query cache. # flush status; create table t1 (a int, b int); create algorithm=temptable view v1 as select * from t1; select * from v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; select * from v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; insert into t1 values (1,1); show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; select * from v1; select * from v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop view v1; show status like "Qcache_queries_in_cache"; show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; # Reset default environment. set GLOBAL query_cache_size=default;
sql/sql_cache.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2184,7 +2184,7 @@ Query_cache::register_tables_from_list(TABLE_LIST *tables_used, tables_used; tables_used= tables_used->next_global, n++, block_table++) { if (tables_used->derived) if (tables_used->derived && !tables_used->view) { DBUG_PRINT("qcache", ("derived table skipped")); n--; Loading