List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:December 19 2008 12:17pm
Subject:bzr commit into mysql-6.0-bugteam branch (Sergey.Glukhov:2814)
Bug#38916
View as plain text  
#At file:///home/gluh/MySQL/mysql-6.0-bug-38916/ based on revid:timothy.smith@stripped

 2814 Sergey Glukhov	2008-12-19
      Bug#38916 Select from I_S.ROUTINES results in "No database selected" error
      The problem is that db name name is not added when
      we create compilable string for the routine.
      The fix is to add db name to this string.
modified:
  mysql-test/r/information_schema.result
  mysql-test/t/information_schema.test
  sql/sp.cc

per-file messages:
  mysql-test/r/information_schema.result
    test result
  mysql-test/t/information_schema.test
    test case
  sql/sp.cc
    The problem is that db name name is not added when
    we create compilable string for the routine.
    The fix is to add db name to this string.
=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result	2008-12-18 16:51:32 +0000
+++ b/mysql-test/r/information_schema.result	2008-12-19 12:17:06 +0000
@@ -1788,3 +1788,9 @@ ERROR 42000: Access denied for user 'roo
 LOCK TABLES t1 READ, information_schema.tables READ;
 ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 DROP TABLE t1;
+create function f1() returns int return 1;
+select routine_name, routine_type from information_schema.routines
+where routine_schema = 'test';
+routine_name	routine_type
+f1	FUNCTION
+drop function f1;

=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test	2008-12-18 10:04:05 +0000
+++ b/mysql-test/t/information_schema.test	2008-12-19 12:17:06 +0000
@@ -1500,3 +1500,14 @@ DROP TABLE t1, information_schema.tables
 --error ER_DBACCESS_DENIED_ERROR
 LOCK TABLES t1 READ, information_schema.tables READ;
 DROP TABLE t1;
+
+#
+# Bug#38916 Select from I_S.ROUTINES results in "No database selected" error
+#
+create function f1() returns int return 1;
+--connect (con7,localhost,root,,*NO-ONE*)
+select routine_name, routine_type from information_schema.routines
+where routine_schema = 'test';
+connection default;
+drop function f1;
+disconnect con7;

=== modified file 'sql/sp.cc'
--- a/sql/sp.cc	2008-07-15 16:29:51 +0000
+++ b/sql/sp.cc	2008-12-19 12:17:06 +0000
@@ -1881,6 +1881,7 @@ sp_cache_routines_and_add_tables_for_tri
     Returns TRUE on success, FALSE on (alloc) failure.
 */
 static bool
+
 create_string(THD *thd, String *buf,
               int type,
               const char *db, ulong dblen,
@@ -2008,7 +2009,7 @@ sp_load_for_information_schema(THD *thd,
   bzero((char*) &sp_chistics, sizeof(sp_chistics));
   defstr.set_charset(creation_ctx->get_client_cs());
   if (!create_string(thd, &defstr, type, 
-                     NULL, 0, 
+                     sp_db_str.str, sp_db_str.length, 
                      sp_name_obj.m_name.str, sp_name_obj.m_name.length, 
                      params, strlen(params),
                      returns, strlen(returns), 

Thread
bzr commit into mysql-6.0-bugteam branch (Sergey.Glukhov:2814)Bug#38916Sergey Glukhov19 Dec