#At file:///Users/mattiasj/mysql-bzr/b60039-trunk/ based on revid:john.embretsen@stripped
3624 Mattias Jonsson 2011-02-10
Bug#60039: crash when exchanging a partition on
nonpartitioned table with a view
Since the table was a view, it was never opened.
Due to this it crashed on null pointer reference.
Fixed by checking the tables before using it.
@ mysql-test/r/partition_error.result
updated result
@ mysql-test/t/partition_error.test
added test
@ sql/sql_partition_admin.cc
check swap_table before using it.
modified:
mysql-test/r/partition_error.result
mysql-test/t/partition_error.test
sql/sql_partition_admin.cc
=== modified file 'mysql-test/r/partition_error.result'
--- a/mysql-test/r/partition_error.result 2011-01-26 20:13:31 +0000
+++ b/mysql-test/r/partition_error.result 2011-02-10 09:49:47 +0000
@@ -1,5 +1,15 @@
drop table if exists t1, t2;
#
+# Bug#60039: crash when exchanging a partition on
+# nonpartitioned table with a view
+#
+CREATE TABLE t1 (a int);
+CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
+ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
+ERROR 42000: Can't open table
+DROP VIEW v1;
+DROP TABLE t1;
+#
# Bug#57924: crash when creating partitioned table with
# multiple columns in the partition key
#
=== modified file 'mysql-test/t/partition_error.test'
--- a/mysql-test/t/partition_error.test 2011-01-26 20:13:31 +0000
+++ b/mysql-test/t/partition_error.test 2011-02-10 09:49:47 +0000
@@ -11,6 +11,17 @@ drop table if exists t1, t2;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo #
+--echo # Bug#60039: crash when exchanging a partition on
+--echo # nonpartitioned table with a view
+--echo #
+CREATE TABLE t1 (a int);
+CREATE OR REPLACE VIEW v1 AS SELECT * FROM t1;
+--error ER_CHECK_NO_SUCH_TABLE
+ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE v1;
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #
--echo # Bug#57924: crash when creating partitioned table with
--echo # multiple columns in the partition key
--echo #
=== modified file 'sql/sql_partition_admin.cc'
--- a/sql/sql_partition_admin.cc 2010-12-03 10:05:56 +0000
+++ b/sql/sql_partition_admin.cc 2011-02-10 09:49:47 +0000
@@ -527,11 +527,12 @@ bool Sql_cmd_alter_table_exchange_partit
part_table= table_list->table;
swap_table= swap_table_list->table;
- table_hton= swap_table->file->ht;
if (check_exchange_partition(swap_table, part_table))
DBUG_RETURN(TRUE);
+ table_hton= swap_table->file->ht;
+
thd_proc_info(thd, "verifying table");
/* Will append the partition name later in part_info->get_part_elem() */
Attachment: [text/bzr-bundle] bzr/mattias.jonsson@oracle.com-20110210094947-87nou5h4etl6rn1c.bundle
| Thread |
|---|
| • bzr commit into mysql-trunk branch (mattias.jonsson:3624) Bug#60039 | Mattias Jonsson | 10 Feb |