List:Internals« Previous MessageNext Message »
From:Alex Ivanov Date:November 21 2005 11:37am
Subject:bk commit into 5.0 tree (aivanov:1.1981) BUG#14554
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alexi. When alexi 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.1981 05/11/21 13:36:48 aivanov@stripped +3 -0
  Fixed BUG #14554: mysqldump does not separate "ROW" and trigger
   statement for tables created in the IGNORE_SPACE sql mode.

  mysql-test/t/mysqldump.test
    1.76 05/11/21 13:36:39 aivanov@stripped +24 -0
    Added test case for bug 14554.

  mysql-test/r/mysqldump.result
    1.83 05/11/21 13:36:39 aivanov@stripped +56 -0
    Fixed test case result for bug 14554.

  client/mysqldump.c
    1.213 05/11/21 13:36:39 aivanov@stripped +2 -1
    Modified dump_triggers_for_table(): if trigger statement returned
     by SHOW TRIGGERS query does not contain a leading white space,
     additional space is inserted between "ROW" and the statement.
     The leading white spaces are removed by yylex() in the
     IGNORE_SPACE sql mode.

# 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:	aivanov
# Host:	mysql.creware.com
# Root:	/home/alexi/dev/mysql-5.0-14554

--- 1.212/client/mysqldump.c	2005-10-28 23:26:10 +04:00
+++ 1.213/client/mysqldump.c	2005-11-21 13:36:39 +03:00
@@ -1841,12 +1841,13 @@
   while ((row= mysql_fetch_row(result)))
   {
     fprintf(sql_file, "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n\
-/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s */;;\n\n",
+/*!50003 CREATE TRIGGER %s %s %s ON %s FOR EACH ROW%s%s */;;\n\n",
             row[6], /* sql_mode */
             quote_name(row[0], name_buff, 0), /* Trigger */
             row[4], /* Timing */
             row[1], /* Event */
             result_table,
+	    (strchr(" \t\n\r", *(row[3]))) ? "" : " ",
             row[3] /* Statement */);
   }
   if (mysql_num_rows(result))

--- 1.82/mysql-test/r/mysqldump.result	2005-11-10 22:32:37 +03:00
+++ 1.83/mysql-test/r/mysqldump.result	2005-11-21 13:36:39 +03:00
@@ -2494,3 +2494,59 @@
 drop view v0;
 drop view v1;
 drop table t1;
+SET @old_sql_mode = @@SQL_MODE;
+SET SQL_MODE = IGNORE_SPACE;
+CREATE TABLE t1 (a INT);
+CREATE TRIGGER tr1 BEFORE INSERT ON t1
+FOR EACH ROW
+BEGIN
+SET new.a = 0;
+END|
+SET SQL_MODE = @old_sql_mode;
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `test`;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+
+/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
+DELIMITER ;;
+/*!50003 SET SESSION SQL_MODE="IGNORE_SPACE" */;;
+/*!50003 CREATE TRIGGER `tr1` BEFORE INSERT ON `t1` FOR EACH ROW BEGIN
+SET new.a = 0;
+END */;;
+
+DELIMITER ;
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TRIGGER tr1;
+DROP TABLE t1;

--- 1.75/mysql-test/t/mysqldump.test	2005-11-10 22:32:37 +03:00
+++ 1.76/mysql-test/t/mysqldump.test	2005-11-21 13:36:39 +03:00
@@ -999,3 +999,27 @@
 drop view v0;
 drop view v1;
 drop table t1;
+
+#
+# BUG#14554 - mysqldump does not separate words "ROW" and "BEGIN"
+# for tables with trigger created in the IGNORE_SPACE sql mode.
+#
+
+SET @old_sql_mode = @@SQL_MODE;
+SET SQL_MODE = IGNORE_SPACE;
+
+CREATE TABLE t1 (a INT);
+DELIMITER |;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1
+       FOR EACH ROW
+       BEGIN
+         SET new.a = 0;
+       END|
+DELIMITER ;|
+
+SET SQL_MODE = @old_sql_mode;
+
+--exec $MYSQL_DUMP --skip-comments --databases test
+
+DROP TRIGGER tr1;
+DROP TABLE t1;
Thread
bk commit into 5.0 tree (aivanov:1.1981) BUG#14554Alex Ivanov21 Nov