Below is the list of changes that have just been committed into a local
5.1 repository of mattiasj. When mattiasj 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-10-05 10:10:18+02:00, mattiasj@mattiasj-laptop.(none) +3 -0
Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
I crashed because of the comment in the partition clause was saved in the frm file without escaping,
causing the server to crash when it was read/parsed again.
Fixed by escaping the comment when writing it to the frm-file
mysql-test/r/partition.result@stripped, 2007-10-05 10:10:15+02:00, mattiasj@mattiasj-laptop.(none) +17 -0
Added testresult for bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
mysql-test/t/partition.test@stripped, 2007-10-05 10:10:15+02:00, mattiasj@mattiasj-laptop.(none) +24 -0
Added test for bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
sql/sql_partition.cc@stripped, 2007-10-05 10:10:15+02:00, mattiasj@mattiasj-laptop.(none) +10 -1
Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
crashes when there is an non escaped apostrophe in the partition comment
fixed by escaping the comments before writing them to the frm-file
diff -Nrup a/mysql-test/r/partition.result b/mysql-test/r/partition.result
--- a/mysql-test/r/partition.result 2007-07-02 20:11:52 +02:00
+++ b/mysql-test/r/partition.result 2007-10-05 10:10:15 +02:00
@@ -1259,6 +1259,23 @@ INSERT INTO t1 SELECT a + 8, b FROM t1;
ALTER TABLE t1 ADD PARTITION (PARTITION p1 VALUES LESS THAN (64));
ALTER TABLE t1 DROP PARTITION p1;
DROP TABLE t1;
+CREATE TABLE t1 (
+d DATE NOT NULL
+)
+PARTITION BY RANGE( YEAR(d) ) (
+PARTITION p0 VALUES LESS THAN (1960),
+PARTITION p1 VALUES LESS THAN (1970),
+PARTITION p2 VALUES LESS THAN (1980),
+PARTITION p3 VALUES LESS THAN (1990)
+);
+ALTER TABLE t1 ADD PARTITION (
+PARTITION `p5` VALUES LESS THAN (2010)
+COMMENT 'START \' åäö ÅÄÖ \\
+\' END'
+);
+SELECT * FROM t1 LIMIT 1;
+d
+DROP TABLE t1;
USE mysql;
SET GLOBAL general_log = 0;
ALTER TABLE general_log ENGINE = MyISAM;
diff -Nrup a/mysql-test/t/partition.test b/mysql-test/t/partition.test
--- a/mysql-test/t/partition.test 2007-07-02 20:11:52 +02:00
+++ b/mysql-test/t/partition.test 2007-10-05 10:10:15 +02:00
@@ -1481,6 +1481,30 @@ ALTER TABLE t1 DROP PARTITION p1;
DROP TABLE t1;
#
+# Bug #30695: An apostrophe ' in the comment of the ADD PARTITION causes the Server to crash.
+#
+
+CREATE TABLE t1 (
+ d DATE NOT NULL
+)
+PARTITION BY RANGE( YEAR(d) ) (
+ PARTITION p0 VALUES LESS THAN (1960),
+ PARTITION p1 VALUES LESS THAN (1970),
+ PARTITION p2 VALUES LESS THAN (1980),
+ PARTITION p3 VALUES LESS THAN (1990)
+);
+
+ALTER TABLE t1 ADD PARTITION (
+PARTITION `p5` VALUES LESS THAN (2010)
+COMMENT 'START \' åäö ÅÄÖ \\
+ \' END'
+);
+
+SELECT * FROM t1 LIMIT 1;
+
+DROP TABLE t1;
+
+#
# Bug #27816: Log tables ran with partitions crashes the server when logging
# is enabled.
#
diff -Nrup a/sql/sql_partition.cc b/sql/sql_partition.cc
--- a/sql/sql_partition.cc 2007-09-14 12:17:40 +02:00
+++ b/sql/sql_partition.cc 2007-10-05 10:10:15 +02:00
@@ -1909,7 +1909,16 @@ static int add_partition_options(File fp
p_elem->index_file_name);
}
if (p_elem->part_comment)
- err+= add_keyword_string(fptr, "COMMENT", TRUE, p_elem->part_comment);
+ {
+ /*
+ Must escape partition comments,
+ parsing it later with mysql_unpack_partition will fail otherwise.
+ */
+ String org_comment(p_elem->part_comment, system_charset_info);
+ String escaped_comment;
+ err+= append_escaped(&escaped_comment, &org_comment);
+ err+= add_keyword_string(fptr, "COMMENT", TRUE, escaped_comment.c_ptr());
+ }
return err + add_engine(fptr,p_elem->engine_type);
}