List:Commits« Previous MessageNext Message »
From:Sergey Glukhov Date:February 19 2009 11:52am
Subject:bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2753)
Bug#40345
View as plain text  
#At file:///home/gluh/MySQL/mysql-5.0-bugteam/ based on revid:alexey.kopytov@stripped

 2753 Sergey Glukhov	2009-02-19
      Bug#40345 MySQLDump prefixes view name with database name when view references other db
      print compact view name if the view belongs to the current database
     @ mysql-test/r/information_schema_db.result
        result fix
     @ mysql-test/r/mysqldump.result
        result fix
     @ mysql-test/r/view_grant.result
        result fix
     @ sql/sql_show.cc
        print compact view name if the view belongs to the current database

    modified:
      mysql-test/r/information_schema_db.result
      mysql-test/r/mysqldump.result
      mysql-test/r/view_grant.result
      sql/sql_show.cc
=== modified file 'mysql-test/r/information_schema_db.result'
--- a/mysql-test/r/information_schema_db.result	2008-10-02 09:37:07 +0000
+++ b/mysql-test/r/information_schema_db.result	2009-02-19 11:51:58 +0000
@@ -188,7 +188,7 @@ Field	Type	Null	Key	Default	Extra
 f1	char(4)	YES		NULL	
 show create view v2;
 View	Create View
-v2	CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
+v2	CREATE ALGORITHM=UNDEFINED DEFINER=`testdb_2`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `v1`.`f1` AS `f1` from `testdb_1`.`v1`
 show create view testdb_1.v1;
 ERROR 42000: SHOW VIEW command denied to user 'testdb_2'@'localhost' for table 'v1'
 select table_name from information_schema.columns a 

=== modified file 'mysql-test/r/mysqldump.result'
--- a/mysql-test/r/mysqldump.result	2009-02-02 21:20:25 +0000
+++ b/mysql-test/r/mysqldump.result	2009-02-19 11:51:58 +0000
@@ -3261,7 +3261,7 @@ USE `mysqldump_views`;
 /*!50001 DROP TABLE `nasishnasifu`*/;
 /*!50001 CREATE ALGORITHM=UNDEFINED */
 /*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
+/*!50001 VIEW `nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
 drop view nasishnasifu;
 drop database mysqldump_views;
 drop table mysqldump_tables.basetable;

=== modified file 'mysql-test/r/view_grant.result'
--- a/mysql-test/r/view_grant.result	2008-02-21 09:17:32 +0000
+++ b/mysql-test/r/view_grant.result	2009-02-19 11:51:58 +0000
@@ -26,7 +26,7 @@ create view v2 as select * from mysqltes
 ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
 show create view v1;
 View	Create View
-v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
 grant create view,drop,select on test.* to mysqltest_1@localhost;
 use test;
 alter view v1 as select * from mysqltest.t1;
@@ -307,7 +307,7 @@ grant create view,select on test.* to my
 create view v1 as select * from mysqltest.t1;
 show create view v1;
 View	Create View
-v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`
 revoke select on mysqltest.t1 from mysqltest_1@localhost;
 select * from v1;
 ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2009-02-17 14:22:48 +0000
+++ b/sql/sql_show.cc	2009-02-19 11:51:58 +0000
@@ -1232,6 +1232,7 @@ void append_definer(THD *thd, String *bu
 static int
 view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
 {
+  my_bool compact_view_name= TRUE;
   my_bool foreign_db_mode= (thd->variables.sql_mode & (MODE_POSTGRESQL |
                                                        MODE_ORACLE |
                                                        MODE_MSSQL |
@@ -1244,7 +1245,7 @@ view_store_create_info(THD *thd, TABLE_L
      - if this view only references table inside it's own db
   */
   if (!thd->db || strcmp(thd->db, table->view_db.str))
-    table->compact_view_format= FALSE;
+    compact_view_name= table->compact_view_format= FALSE;
   else
   {
     TABLE_LIST *tbl;
@@ -1267,7 +1268,7 @@ view_store_create_info(THD *thd, TABLE_L
     view_store_options(thd, table, buff);
   }
   buff->append(STRING_WITH_LEN("VIEW "));
-  if (!table->compact_view_format)
+  if (!compact_view_name)
   {
     append_identifier(thd, buff, table->view_db.str, table->view_db.length);
     buff->append('.');


Attachment: [text/bzr-bundle] bzr/sergey.glukhov@sun.com-20090219115158-ib799h7asjgx5cmt.bundle
Thread
bzr commit into mysql-5.0-bugteam branch (Sergey.Glukhov:2753)Bug#40345Sergey Glukhov19 Feb