List:Commits« Previous MessageNext Message »
From:Ignacio Galarza Date:March 29 2007 4:42pm
Subject:bk commit into 5.1 tree (iggy:1.2490)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of iggy. When iggy 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@stripped, 2007-03-29 10:42:03-04:00, iggy@recycle.(none) +9 -0
  Merge recycle.(none):/src/bug23491/my50-bug23491
  into  recycle.(none):/src/bug23491/my51-bug23491
  MERGE: 1.1810.2373.84

  mysql-test/r/information_schema.result@stripped, 2007-03-29 10:40:24-04:00,
iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.87.1.34

  mysql-test/r/mysqldump.result@stripped, 2007-03-29 10:42:00-04:00, iggy@recycle.(none) +23
-23
    Manual Merge.
    MERGE: 1.83.1.37

  mysql-test/r/sp-code.result@stripped, 2007-03-29 10:40:25-04:00, iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.5.1.5

  mysql-test/r/udf.result@stripped, 2007-03-29 10:40:25-04:00, iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.3.1.9

  mysql-test/t/mysqldump.test@stripped, 2007-03-29 10:40:25-04:00, iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.76.1.35

  sql/item_func.cc@stripped, 2007-03-29 10:40:25-04:00, iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.270.1.58

  sql/sp.cc@stripped, 2007-03-29 10:40:25-04:00, iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.82.1.46

  sql/sp_head.h@stripped, 2007-03-29 10:40:25-04:00, iggy@recycle.(none) +0 -0
    Auto merged
    MERGE: 1.79.1.15

  sql/sql_yacc.yy@stripped, 2007-03-29 10:42:00-04:00, iggy@recycle.(none) +0 -2
    Manual Merge.
    MERGE: 1.371.1.140

# 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:	iggy
# Host:	recycle.(none)
# Root:	/src/bug23491/my51-bug23491/RESYNC

--- 1.365/sql/item_func.cc	2007-03-09 04:39:37 -05:00
+++ 1.366/sql/item_func.cc	2007-03-29 10:40:25 -04:00
@@ -5029,7 +5029,7 @@
 {
   THD *thd= current_thd;
   /* Calculate length to avoid reallocation of string for sure */
-  uint len= ((m_name->m_db.length +
+  uint len= ((m_name->m_explicit_name ? m_name->m_db.length : 0 +
               m_name->m_name.length)*2 + //characters*quoting
              2 +                         // ` and `
              1 +                         // .
@@ -5039,8 +5039,11 @@
                system_charset_info);
 
   qname.length(0);
-  append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length);
-  qname.append('.');
+  if (m_name->m_explicit_name)
+  {
+    append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length);
+    qname.append('.');
+  }
   append_identifier(thd, &qname, m_name->m_name.str, m_name->m_name.length);
   return qname.ptr();
 }

--- 1.553/sql/sql_yacc.yy	2007-03-19 15:44:42 -04:00
+++ 1.554/sql/sql_yacc.yy	2007-03-29 10:42:00 -04:00
@@ -1925,7 +1925,7 @@
 	      my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
 	      MYSQL_YYABORT;
 	    }
-	    $$= new sp_name($1, $3);
+	    $$= new sp_name($1, $3, true);
 	    $$->init_qname(YYTHD);
 	  }
 	| ident
@@ -1939,7 +1939,7 @@
 	    }
             if (thd->copy_db_to(&db.str, &db.length))
               MYSQL_YYABORT;
-	    $$= new sp_name(db, $1);
+	    $$= new sp_name(db, $1, false);
             if ($$)
 	      $$->init_qname(YYTHD);
 	  }

--- 1.147/mysql-test/r/information_schema.result	2007-02-13 16:15:18 -05:00
+++ 1.148/mysql-test/r/information_schema.result	2007-03-29 10:40:24 -04:00
@@ -706,7 +706,7 @@
 Warning	1356	View 'test.v2' references invalid table(s) or column(s) or function(s) or
definer/invoker of view lack rights to use them
 show create table v3;
 View	Create View
-v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3`
AS select `test`.`sub1`(1) AS `c`
+v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3`
AS select `sub1`(1) AS `c`
 Warnings:
 Warning	1356	View 'test.v3' references invalid table(s) or column(s) or function(s) or
definer/invoker of view lack rights to use them
 drop view v2;

--- 1.18/mysql-test/r/udf.result	2007-01-24 10:51:04 -05:00
+++ 1.19/mysql-test/r/udf.result	2007-03-29 10:40:25 -04:00
@@ -159,7 +159,7 @@
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using temporary; Using filesort
 Warnings:
-Note	1003	select myfunc_int(`test`.`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c`
from `test`.`t1` group by `test`.`t1`.`a`
+Note	1003	select myfunc_int(`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from
`test`.`t1` group by `test`.`t1`.`a`
 EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using temporary; Using filesort

--- 1.13/mysql-test/r/sp-code.result	2007-01-24 11:12:28 -05:00
+++ 1.14/mysql-test/r/sp-code.result	2007-03-29 10:40:25 -04:00
@@ -187,7 +187,7 @@
 32	set v_dig@4 (v_dig@4 + 1)
 33	stmt 4 "update sudoku_work set dig = v_dig wh..."
 34	set v_tcounter@6 (v_tcounter@6 + 1)
-35	jump_if_not 37(37) (not(`test`.`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
+35	jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
 36	jump 15
 37	set v_i@3 (v_i@3 + 1)
 38	jump 15

--- 1.141/sql/sp.cc	2007-03-16 19:13:18 -04:00
+++ 1.142/sql/sp.cc	2007-03-29 10:40:25 -04:00
@@ -1091,7 +1091,7 @@
     lex_name.length= strlen(routine->table_name);
     lex_db.str= thd->strmake(routine->db, lex_db.length);
     lex_name.str= thd->strmake(routine->table_name, lex_name.length);
-    name= new sp_name(lex_db, lex_name);
+    name= new sp_name(lex_db, lex_name, true);
     name->init_qname(thd);
     sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
                                      &thd->sp_proc_cache, FALSE) != NULL ||

--- 1.99/sql/sp_head.h	2007-03-07 18:02:32 -05:00
+++ 1.100/sql/sp_head.h	2007-03-29 10:40:25 -04:00
@@ -59,9 +59,10 @@
     calling set_routine_type().
   */
   LEX_STRING m_sroutines_key;
+  bool       m_explicit_name;                   /**< Prepend the db name? */
 
-  sp_name(LEX_STRING db, LEX_STRING name)
-    : m_db(db), m_name(name)
+  sp_name(LEX_STRING db, LEX_STRING name, bool use_explicit_name)
+    : m_db(db), m_name(name), m_explicit_name(use_explicit_name)
   {
     m_qname.str= m_sroutines_key.str= 0;
     m_qname.length= m_sroutines_key.length= 0;
@@ -79,6 +80,7 @@
     m_name.length= m_qname.length= key_len - 1;
     m_db.str= 0;
     m_db.length= 0;
+    m_explicit_name= false;
   }
 
   // Init. the qualified name from the db and name.

--- 1.137/mysql-test/r/mysqldump.result	2006-12-08 17:52:14 -05:00
+++ 1.138/mysql-test/r/mysqldump.result	2007-03-29 10:42:00 -04:00
@@ -3217,6 +3217,29 @@
 </mysqldump>
 DROP TABLE t1;
 #
+# Bug #23491: MySQLDump prefix function call in a view by database name
+#
+create database bug23491_original;
+create database bug23491_restore;
+use bug23491_original;
+create table t1 (c1 int);
+create view v1 as select * from t1;
+create procedure p1() select 1;
+create function f1() returns int return 1;
+create view v2 as select f1();
+create function f2() returns int return f1();
+create view v3 as select bug23491_original.f1();
+use bug23491_restore;
+show create view bug23491_restore.v2;
+View	Create View
+v2	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2`
AS select `f1`() AS `f1()`
+show create view bug23491_restore.v3;
+View	Create View
+v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3`
AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()`
+drop database bug23491_original;
+drop database bug23491_restore;
+use test;
+#
 # End of 5.0 tests
 #
 drop table if exists t1;

--- 1.130/mysql-test/t/mysqldump.test	2007-02-19 14:30:58 -05:00
+++ 1.131/mysql-test/t/mysqldump.test	2007-03-29 10:40:25 -04:00
@@ -1432,6 +1432,38 @@
 DROP TABLE t1;
 
 --echo #
+--echo # Bug #23491: MySQLDump prefix function call in a view by database name
+--echo #
+
+# Setup
+create database bug23491_original;
+create database bug23491_restore;
+use bug23491_original;
+create table t1 (c1 int);
+create view v1 as select * from t1;
+create procedure p1() select 1;
+create function f1() returns int return 1;
+create view v2 as select f1();
+create function f2() returns int return f1();
+create view v3 as select bug23491_original.f1();
+
+# Backup.
+--exec $MYSQL_DUMP --skip-comments -uroot --opt --routines bug23491_original >
$MYSQLTEST_VARDIR/tmp/bug23491_backup.sql;
+
+# Restore.
+--exec $MYSQL bug23491_restore < $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql;
+
+# Verify
+use bug23491_restore;
+show create view bug23491_restore.v2;
+show create view bug23491_restore.v3;
+
+# Cleanup
+drop database bug23491_original;
+drop database bug23491_restore;
+use test;
+
+--echo #
 --echo # End of 5.0 tests
 --echo #
 
Thread
bk commit into 5.1 tree (iggy:1.2490)Ignacio Galarza29 Mar