Below is the list of changes that have just been committed into a local
5.0 repository of patg. When patg 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.2031 05/10/12 20:49:24 patg@stripped +3 -0
BUG# 13146
- Fix to turn off ansi quotes for triggers in dump file.
mysql-test/t/mysqldump.test
1.69 05/10/12 20:48:17 patg@stripped +34 -0
BUG# 13146
-Results to see that triggers are not quoted with ansi quotes
mysql-test/r/mysqldump.result
1.74 05/10/12 20:48:16 patg@stripped +61 -0
BUG# 13146
-Test to see that ansi quotes are not used in dump
client/mysqldump.c
1.204 05/10/12 20:48:15 patg@stripped +28 -4
BUG# 13146
- Un-Set MASK_ANSI_QUOTES mask to global opt_compatible mode when dumping
triggers to fix the problem with ansi quotes '"' not working on reload
of data
# 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: patg
# Host: radha.local
# Root: /Users/patg/mysql-build/mysql-5.0.bug13146
--- 1.203/client/mysqldump.c 2005-09-27 18:40:42 +02:00
+++ 1.204/client/mysqldump.c 2005-10-12 20:48:15 +02:00
@@ -947,11 +947,27 @@
} /* test_if_special_chars */
+/*
+ quote_name(name, buff, force)
+
+ Quotes char string, taking into account compatible mode
+
+ Args
+
+ name Unquoted string containing that which will be quoted
+ buff The buffer that contains the quoted value, also returned
+ force Flag to make it ignore 'test_if_special_chars'
+ Returns
+
+ buff quoted string
+
+*/
static char *quote_name(const char *name, char *buff, my_bool force)
{
char *to= buff;
- char qtype= (opt_compatible_mode & MASK_ANSI_QUOTES) ? '\"' : '`';
+ char qtype= (opt_compatible_mode & MASK_ANSI_QUOTES) ?
+ '\"' : '`';
if (!force && !opt_quoted && !test_if_special_chars(name))
return (char*) name;
@@ -1575,7 +1591,7 @@
row[SHOW_TYPE]);
else
fprintf(sql_file, " %s %s", quote_name(row[SHOW_FIELDNAME],
- name_buff, 0),
+ name_buff, 0),
row[SHOW_TYPE]);
if (row[SHOW_DEFAULT])
{
@@ -1747,15 +1763,18 @@
static void dump_triggers_for_table (char *table, char *db)
{
- MYSQL_RES *result;
- MYSQL_ROW row;
char *result_table;
char name_buff[NAME_LEN*4+3], table_buff[NAME_LEN*2+3];
char query_buff[512];
FILE *sql_file = md_result_file;
+ uint old_opt_compatible_mode=opt_compatible_mode;
+ MYSQL_RES *result;
+ MYSQL_ROW row;
DBUG_ENTER("dump_triggers_for_table");
DBUG_PRINT("enter", ("db: %s, table: %s", db, table));
+ /* Do not use ANSI_QUOTES on triggers in dump */
+ opt_compatible_mode&= ~MASK_ANSI_QUOTES;
result_table= quote_name(table, table_buff, 1);
my_snprintf(query_buff, sizeof(query_buff),
@@ -1788,6 +1807,11 @@
"DELIMITER ;//\n\
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;");
mysql_free_result(result);
+ /*
+ make sure to set back opt_compatible mode to
+ original value
+ */
+ opt_compatible_mode=old_opt_compatible_mode;
DBUG_VOID_RETURN;
}
--- 1.73/mysql-test/r/mysqldump.result 2005-09-30 09:40:22 +02:00
+++ 1.74/mysql-test/r/mysqldump.result 2005-10-12 20:48:16 +02:00
@@ -2123,3 +2123,64 @@
DROP PROCEDURE bug9056_proc1;
DROP PROCEDURE bug9056_proc2;
drop table t1;
+DROP TABLE IF EXISTS `t1 test`;
+CREATE TABLE `t1 test` (
+`a1` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+DROP TABLE IF EXISTS `t2 test`;
+CREATE TABLE `t2 test` (
+`a2` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
+INSERT INTO `t2 test` SET a2 = NEW.a1; END //
+INSERT INTO `t1 test` VALUES (1);
+INSERT INTO `t1 test` VALUES (2);
+INSERT INTO `t1 test` VALUES (3);
+SELECT * FROM `t2 test`;
+a2
+1
+2
+3
+/*!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,ANSI' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS "t1 test";
+CREATE TABLE "t1 test" (
+ "a1" int(11) default NULL
+);
+
+
+/*!40000 ALTER TABLE "t1 test" DISABLE KEYS */;
+LOCK TABLES "t1 test" WRITE;
+INSERT INTO "t1 test" VALUES (1),(2),(3);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE "t1 test" ENABLE KEYS */;
+
+/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;
+DELIMITER //;
+/*!50003 SET SESSION SQL_MODE="" */ //
+/*!50003 CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
+INSERT INTO `t2 test` SET a2 = NEW.a1; END */ //
+
+DELIMITER ;//
+/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;DROP TABLE IF EXISTS "t2 test";
+CREATE TABLE "t2 test" (
+ "a2" int(11) default NULL
+);
+
+
+/*!40000 ALTER TABLE "t2 test" DISABLE KEYS */;
+LOCK TABLES "t2 test" WRITE;
+INSERT INTO "t2 test" VALUES (1),(2),(3);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE "t2 test" ENABLE KEYS */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TRIGGER `test trig`;
+DROP TABLE `t1 test`;
+DROP TABLE `t2 test`;
--- 1.68/mysql-test/t/mysqldump.test 2005-09-30 22:37:50 +02:00
+++ 1.69/mysql-test/t/mysqldump.test 2005-10-12 20:48:17 +02:00
@@ -907,3 +907,37 @@
DROP PROCEDURE bug9056_proc2;
drop table t1;
+#
+# Test of fix to BUG 13146
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS `t1 test`;
+CREATE TABLE `t1 test` (
+ `a1` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+DROP TABLE IF EXISTS `t2 test`;
+CREATE TABLE `t2 test` (
+ `a2` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+--enable_warnings
+
+DELIMITER //;
+CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
+INSERT INTO `t2 test` SET a2 = NEW.a1; END //
+DELIMITER ;//
+
+INSERT INTO `t1 test` VALUES (1);
+INSERT INTO `t1 test` VALUES (2);
+INSERT INTO `t1 test` VALUES (3);
+SELECT * FROM `t2 test`;
+# dump with compatible=ansi. Everything except triggers should be double
+# quoted
+--exec $MYSQL_DUMP --skip-comments --compatible=ansi --triggers test
+
+--disable_warnings
+DROP TRIGGER `test trig`;
+DROP TABLE `t1 test`;
+DROP TABLE `t2 test`;
+--enable_warnings
| Thread |
|---|
| • bk commit into 5.0 tree (patg:1.2031) BUG#13146 | Patrick Galbraith | 12 Oct |