From: Date: November 22 2005 9:18am Subject: bk commit into 5.0 tree (bell:1.1988) BUG#15096 List-Archive: http://lists.mysql.com/internals/32518 X-Bug: 15096 Message-Id: <20051122081843.D420845603A@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.1988 05/11/22 10:18:37 bell@stripped +3 -0 View creation code fixed to expect empty TABLE_LIST::table pointer (BUG#15096). sql/sql_view.cc 1.79 05/11/22 10:18:33 bell@stripped +3 -2 View placed in a function never get TABLE during view creation, because we have never executed that function in this process. So we should expect empty TABLE_LIST::table pointer. mysql-test/t/view.test 1.127 05/11/22 10:18:33 bell@stripped +21 -0 BUG#15096 test suite. mysql-test/r/view.result 1.137 05/11/22 10:18:33 bell@stripped +15 -0 BUG#15096 test suite. # 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: sanja.is.com.ua # Root: /home/bell/mysql/bk/work-bug3-5.0 --- 1.136/mysql-test/r/view.result 2005-11-18 16:26:43 +02:00 +++ 1.137/mysql-test/r/view.result 2005-11-22 10:18:33 +02:00 @@ -2424,3 +2424,18 @@ 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; --- 1.126/mysql-test/t/view.test 2005-11-18 16:26:43 +02:00 +++ 1.127/mysql-test/t/view.test 2005-11-22 10:18:33 +02:00 @@ -2280,3 +2280,24 @@ 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; --- 1.78/sql/sql_view.cc 2005-11-21 21:15:43 +02:00 +++ 1.79/sql/sql_view.cc 2005-11-22 10:18:33 +02:00 @@ -351,7 +351,7 @@ for (tbl= lex->query_tables; tbl; tbl= tbl->next_global) { /* is this table temporary and is not view? */ - if (tbl->table->s->tmp_table != NO_TMP_TABLE && !tbl->view && + if (!tbl->view && tbl->table->s->tmp_table != NO_TMP_TABLE && !tbl->schema_table) { my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias); @@ -374,7 +374,8 @@ fill_effective_table_privileges (they were not copied at derived tables processing) */ - tbl->table->grant.privilege= tbl->grant.privilege; + if (tbl->table) + tbl->table->grant.privilege= tbl->grant.privilege; } /* prepare select to resolve all fields */