#At file:///Users/mattiasj/clones/bzrroot/b38719-60-bugteam/
2824 Mattias Jonsson 2008-09-04
Bug#38719: Partitioning returns a different error code for
a duplicate key error
handler::get_dup_key used the called handler for the
info call, but used table->file handler for errkey
Fixed by using table->file->info() instead.
modified:
mysql-test/r/partition_error.result
mysql-test/t/partition_error.test
sql/handler.cc
per-file messages:
mysql-test/r/partition_error.result
Bug#38719: Partitioning returns a different error code for
a duplicate key error
updated results
mysql-test/t/partition_error.test
Bug#38719: Partitioning returns a different error code for
a duplicate key error
Added verification test
sql/handler.cc
Bug#38719: Partitioning returns a different error code for
a duplicate key error
handler::get_dup_key used the called handler for the
info call, but used table->file handler for errkey
Fixed by using table->file->info() instead.
=== modified file 'mysql-test/r/partition_error.result'
--- a/mysql-test/r/partition_error.result 2008-02-25 20:18:50 +0000
+++ b/mysql-test/r/partition_error.result 2008-09-04 12:00:14 +0000
@@ -1,4 +1,13 @@
drop table if exists t1;
+CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
+INSERT INTO t1 VALUES (1),(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1;
+CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a))
+PARTITION BY KEY (a) PARTITIONS 2;
+INSERT INTO t1 VALUES (1),(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1;
CREATE TABLE t1 (a INT)
PARTITION BY HASH (a)
( PARTITION p0 ENGINE=MyISAM,
=== modified file 'mysql-test/t/partition_error.test'
--- a/mysql-test/t/partition_error.test 2008-02-25 20:18:50 +0000
+++ b/mysql-test/t/partition_error.test 2008-09-04 12:00:14 +0000
@@ -1,5 +1,5 @@
#
-# Simple test for the erroneos create statements using the
+# Simple test for the erroneos statements using the
# partition storage engine
#
-- source include/have_partition.inc
@@ -7,6 +7,19 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
+
+#
+# Bug#38719: Partitioning returns a different error code for a
+# duplicate key error
+CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a));
+-- error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1),(1);
+DROP TABLE t1;
+CREATE TABLE t1 (a INTEGER NOT NULL, PRIMARY KEY (a))
+PARTITION BY KEY (a) PARTITIONS 2;
+-- error ER_DUP_ENTRY
+INSERT INTO t1 VALUES (1),(1);
+DROP TABLE t1;
#
# Bug#31931: Mix of handlers error message
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2008-09-03 14:40:19 +0000
+++ b/sql/handler.cc 2008-09-04 12:00:14 +0000
@@ -2862,7 +2862,7 @@ uint handler::get_dup_key(int error)
if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOREIGN_DUPLICATE_KEY ||
error == HA_ERR_FOUND_DUPP_UNIQUE || error == HA_ERR_NULL_IN_SPATIAL ||
error == HA_ERR_DROP_INDEX_FK)
- info(HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK);
+ table->file->info(HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK);
DBUG_RETURN(table->file->errkey);
}
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (mattias.jonsson:2824) Bug#38719 | Mattias Jonsson | 4 Sep |