List:Commits« Previous MessageNext Message »
From:Greg Lehey Date:July 28 2006 7:49am
Subject:bk commit into 5.0 tree (grog:1.2211) BUG#13926
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of grog. When grog 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, 2006-07-28 15:19:44+09:30, grog@stripped +3 -0
  mysqldump.test:
    BUG#13926: mysqldump --order-by-primary fails if PK column needs quoting
    Test case.
  mysqldump.c:
    BUG#13926: mysqldump --order-by-primary fails if PK column needs quoting
  mysqldump.result:
    BUG#13926: mysqldump --order-by-primary fails if PK column needs quoting
    Results of test case.

  client/mysqldump.c@stripped, 2006-07-28 15:18:15+09:30, grog@stripped +12 -6
    BUG#13926: mysqldump --order-by-primary fails if PK column needs quoting

  mysql-test/r/mysqldump.result@stripped, 2006-07-28 15:17:35+09:30, grog@stripped +72 -0
    BUG#13926: mysqldump --order-by-primary fails if PK column needs quoting
    Results of test case.

  mysql-test/t/mysqldump.test@stripped, 2006-07-28 15:17:08+09:30, grog@stripped +19 -0
    BUG#13926: mysqldump --order-by-primary fails if PK column needs quoting
    Test case.

# 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:	grog
# Host:	eucla.lemis.com
# Root:	/MySQL/5.0-Bug-13926

--- 1.230/client/mysqldump.c	2006-07-28 15:19:51 +09:30
+++ 1.231/client/mysqldump.c	2006-07-28 15:19:51 +09:30
@@ -3214,6 +3214,8 @@
   char show_keys_buff[15 + 64 * 2 + 3];
   uint result_length = 0;
   char *result = 0;
+  char buff[NAME_LEN*2+3];
+  char *quoted_field;
 
   my_snprintf(show_keys_buff, sizeof(show_keys_buff),
               "SHOW KEYS FROM %s", table_name);
@@ -3236,9 +3238,10 @@
   if ((row = mysql_fetch_row(res)) && atoi(row[1]) == 0)
   {
     /* Key is unique */
-    do
-      result_length += strlen(row[4]) + 1;      /* + 1 for ',' or \0 */
-    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1);
+    do {
+      quoted_field = quote_name(row[4], buff, 0);
+      result_length += strlen(quoted_field) + 1;      /* + 1 for ',' or \0 */
+    } while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1);
   }
 
   /* Build the ORDER BY clause result */
@@ -3254,9 +3257,12 @@
     }
     mysql_data_seek(res, 0);
     row = mysql_fetch_row(res);
-    end = strmov(result, row[4]);
-    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1)
-      end = strxmov(end, ",", row[4], NullS);
+    quoted_field = quote_name(row[4], buff, 0);
+    end = strmov(result, quoted_field);
+    while ((row = mysql_fetch_row(res)) && atoi(row[3]) > 1) {
+      quoted_field = quote_name(row[4], buff, 0);
+      end = strxmov(end, ",", quoted_field, NullS);
+    }
   }
 
 cleanup:

--- 1.98/mysql-test/r/mysqldump.result	2006-07-28 15:19:51 +09:30
+++ 1.99/mysql-test/r/mysqldump.result	2006-07-28 15:19:51 +09:30
@@ -2816,3 +2816,75 @@
 drop view v1;
 drop table t1;
 drop database mysqldump_test_db;
+USE test;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+`a b` INT,
+`c"d` INT,
+`e``f` INT,
+PRIMARY KEY (`a b`, `c"d`, `e``f`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (0815, 4711, 2006);
+/*!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,ANSI' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS "t1";
+CREATE TABLE "t1" (
+  "a b" int(11) NOT NULL default '0',
+  "c""d" int(11) NOT NULL default '0',
+  "e`f" int(11) NOT NULL default '0',
+  PRIMARY KEY  ("a b","c""d","e`f")
+);
+
+
+/*!40000 ALTER TABLE "t1" DISABLE KEYS */;
+LOCK TABLES "t1" WRITE;
+INSERT INTO "t1" VALUES (815,4711,2006);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE "t1" ENABLE KEYS */;
+/*!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 */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+
+/*!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 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a b` int(11) NOT NULL default '0',
+  `c"d` int(11) NOT NULL default '0',
+  `e``f` int(11) NOT NULL default '0',
+  PRIMARY KEY  (`a b`,`c"d`,`e``f`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+
+/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
+LOCK TABLES `t1` WRITE;
+INSERT INTO `t1` VALUES (815,4711,2006);
+UNLOCK TABLES;
+/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
+/*!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 TABLE `t1`;

--- 1.90/mysql-test/t/mysqldump.test	2006-07-28 15:19:51 +09:30
+++ 1.91/mysql-test/t/mysqldump.test	2006-07-28 15:19:51 +09:30
@@ -1178,3 +1178,22 @@
 drop view v1;
 drop table t1;
 drop database mysqldump_test_db;
+
+#
+# BUG#13926: --order-by-primary fails if PKEY contains quote character
+#
+--disable_warnings
+USE test;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+  `a b` INT,
+  `c"d` INT,
+  `e``f` INT,
+  PRIMARY KEY (`a b`, `c"d`, `e``f`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+insert into t1 values (0815, 4711, 2006);
+
+--exec $MYSQL_DUMP --skip-comments --compatible=ansi --order-by-primary test t1
+--exec $MYSQL_DUMP --skip-comments --order-by-primary test t1
+DROP TABLE `t1`;
+--enable_warnings
Thread
bk commit into 5.0 tree (grog:1.2211) BUG#13926Greg Lehey28 Jul