MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Tatjana A Nuernberg Date:May 31 2006 11:36am
Subject:bk commit into 5.0 tree (tnurnberg:1.2128) BUG#18462
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tnurnberg. When tnurnberg 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.2128 06/05/31 13:36:28 tnurnberg@stripped +3 -0
  Bug#18462: mysqldump does not dump view structures correctly
  
  (The above problem only occurs with -T -- create a separate file for
  each table / view.) This ChangeSet results in correct output of view-
  information while omitting the information for the view's stand-in
  table. The rationale is that with -T, the user is likely interested
  in transferring part of a database, not the db in its entirety (that
  would be difficult as replay order is obscure, the files being named
  for the table/view they contain rather than getting a sequence number).

  mysql-test/t/mysqldump.test
    1.86 06/05/31 13:36:20 tnurnberg@stripped +21 -0
    prove mysqldump -T (each item gets its own file) dumps views correctly

  mysql-test/r/mysqldump.result
    1.94 06/05/31 13:36:20 tnurnberg@stripped +19 -0
    prove mysqldump -T (each item gets its own file) dumps views correctly

  client/mysqldump.c
    1.227 06/05/31 13:36:19 tnurnberg@stripped +3 -0
    Added missing fclose(). Before, a view's stand-in table would get
    dumped in get_table_structure(), and the file would remain open.
    get_view_structure() would re-open the same file and write to it,
    resulting in garbage.  The way we handle it now, the table-struct
    gets closed, then the opening of the view-struct (same name)
    overwrites it. (The SQL for the view drop-if-exists the table,
    anyway.) If this were not desired and we wanted SQL for the views
    that contains the create for the stand-in table, we'd hand a mode
    to open_sql_file_for_table(), which would feature O_APPEND in
    get_view_structure(), but not in get_table_structure().

# 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:	tnurnberg
# Host:	salvation.intern.azundris.com
# Root:	/home/mysql-5.0-maint-18462

--- 1.226/client/mysqldump.c	2006-04-18 17:58:22 +02:00
+++ 1.227/client/mysqldump.c	2006-05-31 13:36:19 +02:00
@@ -1554,6 +1554,9 @@
         }
         mysql_free_result(result);
 
+        if (path)
+          my_fclose(sql_file, MYF(MY_WME));
+
         was_views= 1;
         DBUG_RETURN(0);
       }

--- 1.93/mysql-test/r/mysqldump.result	2006-05-04 17:35:52 +02:00
+++ 1.94/mysql-test/r/mysqldump.result	2006-05-31 13:36:20 +02:00
@@ -2717,6 +2717,25 @@
 drop trigger tr1;
 drop trigger tr2;
 drop table t1, t2;
+create table t (qty int, price int);
+insert into t values(3, 50);
+insert into t values(5, 51);
+create view v1 as select qty, price, qty*price as value from t;
+create view v2 as select qty from v1;
+mysqldump {
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */;
+
+} mysqldump {
+/*!50001 CREATE ALGORITHM=UNDEFINED */
+/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
+/*!50001 VIEW `v2` AS select `v1`.`qty` AS `qty` from `v1` */;
+
+} mysqldump
+drop view v1;
+drop view v2;
+drop table t;
 /*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
 return 42 */|
 /*!50003 CREATE PROCEDURE `p`()

--- 1.85/mysql-test/t/mysqldump.test	2006-05-04 17:35:52 +02:00
+++ 1.86/mysql-test/t/mysqldump.test	2006-05-31 13:36:20 +02:00
@@ -1128,6 +1128,27 @@
 
 
 #
+# Bug#18462 mysqldump does not dump view structures correctly
+#
+#
+create table t (qty int, price int);
+insert into t values(3, 50);
+insert into t values(5, 51);
+create view v1 as select qty, price, qty*price as value from t;
+create view v2 as select qty from v1;
+--echo mysqldump {
+--exec $MYSQL_DUMP --compact -F --tab . test
+--exec cat v1.sql
+--echo } mysqldump {
+--exec cat v2.sql
+--echo } mysqldump
+--rm v.sql t.sql t.txt
+drop view v1;
+drop view v2;
+drop table t;
+
+
+#
 # Bug#14857 Reading dump files with single statement stored routines fails.
 # fixed by patch for bug#16878
 #
Thread
bk commit into 5.0 tree (tnurnberg:1.2128) BUG#18462Tatjana A Nuernberg31 May