diff options
author | unknown <gshchepa/uchum@gshchepa.loc> | 2007-04-29 04:16:17 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gshchepa.loc> | 2007-04-29 04:16:17 +0500 |
commit | 98c0da4ed5dd8cbfc8450675e2c008b829367318 (patch) | |
tree | a64b8db2706959f7c4cfb27333e1de68f84a8e9e /mysql-test/t/innodb_mysql.test | |
parent | 78c734b0132fbd53ff033eada5a9664919370739 (diff) | |
download | mariadb-git-98c0da4ed5dd8cbfc8450675e2c008b829367318.tar.gz |
Fixed bug #13191.
INSERT...ON DUPLICATE KEY UPDATE may cause error 1032:
"Can't find record in ..." if we are inserting into
InnoDB table unique index of partial key with
underlying UTF-8 string field.
This error occurs because INSERT...ON DUPLICATE uses a wrong
procedure to copy string fields of multi-byte character sets
for index search.
mysql-test/t/innodb_mysql.test:
Added test case for bug #13191.
mysql-test/r/innodb_mysql.result:
Added test case for bug #13191.
sql/field.h:
Fixed bug #13191.
Field_string::get_key_image() virtual function was overloaded
to implement copying of variable length character (UTF-8) fields.
Field::get_key_image() function prototype has been changed to
return byte size of copied data.
sql/field.cc:
Fixed bug #13191.
Field_string::get_key_image() virtual function was overloaded
to implement copying of variable length character (UTF-8) fields.
Field::get_key_image() function prototype has been changed to
return byte size of copied data.
sql/key.cc:
Fixed bug #13191.
INSERT...ON DUPLICATE KEY UPDATE may cause error 1032:
"Can't find record in ...".
This error occurs because INSERT...ON DUPLICATE uses
a wrong procedure to copy field parts for index search.
key_copy() function has been fixed.
Diffstat (limited to 'mysql-test/t/innodb_mysql.test')
-rw-r--r-- | mysql-test/t/innodb_mysql.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test index c5a5e997775..0973385dc5b 100644 --- a/mysql-test/t/innodb_mysql.test +++ b/mysql-test/t/innodb_mysql.test @@ -161,4 +161,34 @@ show /*!50002 GLOBAL */ status like 'Handler_rollback'; connection default; drop table t1; disconnect con1; + +# +# Bug #13191: INSERT...ON DUPLICATE KEY UPDATE of UTF-8 string fields +# used in partial unique indices. +# + +CREATE TABLE t1(c1 TEXT, UNIQUE (c1(1)), cnt INT DEFAULT 1) + ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(c1 VARCHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1) + ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +DROP TABLE t1; + +CREATE TABLE t1(c1 CHAR(2), UNIQUE (c1(1)), cnt INT DEFAULT 1) + ENGINE=INNODB CHARACTER SET UTF8; +INSERT INTO t1 (c1) VALUES ('1a'); +SELECT * FROM t1; +INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1; +SELECT * FROM t1; +DROP TABLE t1; + --echo End of 4.1 tests |