List:Commits« Previous MessageNext Message »
From:Mattias Jonsson Date:February 18 2009 8:29pm
Subject:bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:2804)
Bug#38719
View as plain text  
#At file:///Users/mattiasj/clones/bzrroot/topush-51-bugteam/ based on revid:mattias.jonsson@stripped

 2804 Mattias Jonsson	2009-02-18
      Backport of bug#38719 from 6.0 to 5.1
      
      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.
     @ mysql-test/r/partition_error.result
        Bug#38719: Partitioning returns a different error code for
        a duplicate key error
        
        Added test for verification
     @ mysql-test/t/partition_error.test
        Bug#38719: Partitioning returns a different error code for
        a duplicate key error
        
        Added test for verification
     @ sql/handler.cc
        Backport of bug#38719 from 6.0 to 5.1
        
        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
=== modified file 'mysql-test/r/partition_error.result'
--- a/mysql-test/r/partition_error.result	2008-04-03 09:50:43 +0000
+++ b/mysql-test/r/partition_error.result	2009-02-18 20:29:30 +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-04-03 09:50:43 +0000
+++ b/mysql-test/t/partition_error.test	2009-02-18 20:29:30 +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	2009-02-10 08:37:27 +0000
+++ b/sql/handler.cc	2009-02-18 20:29:30 +0000
@@ -2932,7 +2932,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);
 }
 


Attachment: [text/bzr-bundle] bzr/mattias.jonsson@sun.com-20090218202930-789xxjqfocw030c4.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (mattias.jonsson:2804)Bug#38719Mattias Jonsson18 Feb