From ee0b7d895d42b0e3c93bdbffa7c4d3f51c1f60c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 3 Sep 2007 12:22:56 +0500 Subject: Bug#29408 Cannot find view in columns table if the selection contains a function Use view db name as thread default database, in order to ensure that the view is parsed and prepared correctly. mysql-test/r/sp.result: test result mysql-test/t/sp.test: test case sql/sql_parse.cc: copy thd->db_length to table_list->db_length sql/sql_view.cc: Use view db name as thread default database, in order to ensure that the view is parsed and prepared correctly. --- mysql-test/t/sp.test | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'mysql-test/t/sp.test') diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 46a1b1dc740..f1c7c6969db 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -7299,4 +7299,37 @@ CALL p1(); SET NAMES default; DROP PROCEDURE p1; +# +# Bug#29408 Cannot find view in columns table if the selection contains a function +# +delimiter |; + +create function f1() + returns int(11) +not deterministic +contains sql +sql security definer +comment '' +begin + declare x int(11); + set x=-1; + return x; +end| + +delimiter ;| + +create view v1 as select 1 as one, f1() as days; + +connect (bug29408, localhost, root,,*NO-ONE*); +connection bug29408; + +show create view test.v1; +select column_name from information_schema.columns +where table_name='v1' and table_schema='test'; + +connection default; +disconnect bug29408; +drop view v1; +drop function f1; + --echo End of 5.0 tests -- cgit v1.2.1