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.
This commit is contained in:
parent
5b15e3de83
commit
e2cf7f14a0
@ -1,4 +1,13 @@
|
|||||||
drop table if exists t1;
|
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)
|
CREATE TABLE t1 (a INT)
|
||||||
PARTITION BY HASH (a)
|
PARTITION BY HASH (a)
|
||||||
( PARTITION p0 ENGINE=MyISAM,
|
( PARTITION p0 ENGINE=MyISAM,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Simple test for the erroneos create statements using the
|
# Simple test for the erroneos statements using the
|
||||||
# partition storage engine
|
# partition storage engine
|
||||||
#
|
#
|
||||||
-- source include/have_partition.inc
|
-- source include/have_partition.inc
|
||||||
@ -7,6 +7,19 @@
|
|||||||
--disable_warnings
|
--disable_warnings
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
--enable_warnings
|
--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
|
# Bug#31931: Mix of handlers error message
|
||||||
|
@ -2932,7 +2932,7 @@ uint handler::get_dup_key(int error)
|
|||||||
if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOREIGN_DUPLICATE_KEY ||
|
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_FOUND_DUPP_UNIQUE || error == HA_ERR_NULL_IN_SPATIAL ||
|
||||||
error == HA_ERR_DROP_INDEX_FK)
|
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);
|
DBUG_RETURN(table->file->errkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user