From: Date: May 14 2005 10:49am Subject: bk commit into 5.0 tree (bell:1.1944) BUG#9758 List-Archive: http://lists.mysql.com/internals/24891 X-Bug: 9758 Message-Id: <20050514084941.348AA51BAD9@book.sanja.is.com.ua> Below is the list of changes that have just been committed into a local 5.0 repository of bell. When bell does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.1944 05/05/14 11:49:25 bell@stripped +3 -0 correct table name recovering for SP locking (BUG#9758) sql/sp_head.cc 1.134 05/05/14 11:49:18 bell@stripped +19 -5 constant replaced with define correct table name recovering mysql-test/t/view.test 1.69 05/05/14 11:49:18 bell@stripped +20 -1 test for bug#9758 mysql-test/r/view.result 1.80 05/05/14 11:49:17 bell@stripped +14 -0 test for bug#9758 # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: bell # Host: book.sanja.is.com.ua # Root: /Users/bell/mysql/bk/work-bug-5.0 --- 1.79/mysql-test/r/view.result 2005-05-11 02:41:42 +03:00 +++ 1.80/mysql-test/r/view.result 2005-05-14 11:49:17 +03:00 @@ -1712,3 +1712,17 @@ 2 2 4 4 DROP VIEW v2,v1; +DROP TABLE t1, t2; +create table t1 (a int); +create view v1 as select sum(a) from t1 group by a; +create procedure p1() +begin +select * from v1; +end// +call p1(); +sum(a) +call p1(); +sum(a) +drop procedure p1; +drop view v1; +drop table t1; --- 1.68/mysql-test/t/view.test 2005-05-11 02:41:42 +03:00 +++ 1.69/mysql-test/t/view.test 2005-05-14 11:49:18 +03:00 @@ -1521,8 +1521,10 @@ DROP VIEW v1,v2,v3; DROP TABLE t1,t2; +# # BUG#8490 Select from views containing subqueries causes server to hang # forever. +# create table t1 as select 1 A union select 2 union select 3; create table t2 as select * from t1; create view v1 as select * from t1 where a in (select * from t2); @@ -1537,7 +1539,6 @@ # # Test case for bug #8528: select from view over multi-table view # - CREATE TABLE t1 (a int); CREATE TABLE t2 (b int); INSERT INTO t1 VALUES (1), (2), (3), (4); @@ -1549,3 +1550,21 @@ SELECT * FROM v2; DROP VIEW v2,v1; +DROP TABLE t1, t2; +# +# Correct restoring view name in SP table locking BUG#9758 +# +create table t1 (a int); +create view v1 as select sum(a) from t1 group by a; +delimiter //; +create procedure p1() +begin +select * from v1; +end// +delimiter ;// +call p1(); +call p1(); +drop procedure p1; +drop view v1; +drop table t1; + --- 1.133/sql/sp_head.cc 2005-05-09 02:01:23 +03:00 +++ 1.134/sql/sp_head.cc 2005-05-14 11:49:18 +03:00 @@ -2150,7 +2150,7 @@ for (; table ; table= table->next_global) if (!table->derived && !table->schema_table) { - char tname[64+1+64+1+64+1]; // db.table.alias\0 + char tname[NAME_LEN + 1 + NAME_LEN + 1 + NAME_LEN + 1];// db.table.alias\0 uint tlen, alen; tlen= table->db_length; @@ -2257,11 +2257,25 @@ that the PS will be invalidated if the functions is deleted or changed. */ - table->db= otable->db; - table->db_length= otable->db_length; + if (otable->view_name.length) + { + /* + For view real name should be restored from view_name/view_db, + because table_name/db can be replaced with temporary table + */ + table->db= otable->view_db.str; + table->db_length= otable->view_db.length; + table->table_name= otable->view_name.str; + table->table_name_length= otable->view_name.length; + } + else + { + table->db= otable->db; + table->db_length= otable->db_length; + table->table_name= otable->table_name; + table->table_name_length= otable->table_name_length; + } table->alias= otable->alias; - table->table_name= otable->table_name; - table->table_name_length= otable->table_name_length; table->lock_type= stab->lock_type; table->cacheable_table= 1; table->prelocking_placeholder= 1;