summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-04-29 18:39:45 +0500
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-04-29 18:39:45 +0500
commit0cd6377f2815db838a0f58acfbd6a2dcdb6cd5af (patch)
tree765473b871af39c0d2e7edb8b244cd7600e9cdb7 /mysql-test
parenta4bfd854145379f86bf622a44e28ced6136c8fa8 (diff)
parente8225073649844a43bc4ea6362a5df5e6210933b (diff)
downloadmariadb-git-0cd6377f2815db838a0f58acfbd6a2dcdb6cd5af.tar.gz
Merge bk@192.168.21.1:mysql-4.1
into mysql.com:/d2/hf/mrg/mysql-4.1-opt
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/alter_table.result5
-rw-r--r--mysql-test/r/heap.result2
-rw-r--r--mysql-test/r/innodb_mysql.result33
-rw-r--r--mysql-test/t/alter_table.test11
-rw-r--r--mysql-test/t/innodb_mysql.test30
5 files changed, 80 insertions, 1 deletions
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index da5cf688325..8957e1ee7a1 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -803,3 +803,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
alter table table_24562 order by no_such_col;
ERROR 42S22: Unknown column 'no_such_col' in 'order clause'
drop table table_24562;
+CREATE TABLE t1 (c1 CHAR(255));
+INSERT INTO t1 VALUES (REPEAT("x", 255)), (REPEAT("x", 255));
+ALTER TABLE t1 ADD UNIQUE (c1);
+ERROR 23000: Duplicate entry 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' for key 1
+DROP TABLE t1;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 6bb9d0c87ee..b19ccca2f44 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -294,7 +294,7 @@ drop table t1;
create table t1 (c char(255), primary key(c(90)));
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
-ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
+ERROR 23000: Duplicate entry 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl' for key 1
drop table t1;
CREATE TABLE t1 (a int, key(a)) engine=heap;
insert into t1 values (0);
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 2cd6f7826ca..12c8b414d2d 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -128,4 +128,37 @@ show /*!50002 GLOBAL */ status like 'Handler_rollback';
Variable_name Value
Handler_rollback 0
drop table t1;
+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;
+c1 cnt
+1a 1
+INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+c1 cnt
+1a 2
+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;
+c1 cnt
+1a 1
+INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+c1 cnt
+1a 2
+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;
+c1 cnt
+1a 1
+INSERT INTO t1 (c1) VALUES ('1b') ON DUPLICATE KEY UPDATE cnt=cnt+1;
+SELECT * FROM t1;
+c1 cnt
+1a 2
+DROP TABLE t1;
End of 4.1 tests
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 52a569dfb57..874c42ac0b6 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -583,5 +583,16 @@ alter table table_24562 order by no_such_col;
drop table table_24562;
+#
+# Bug #20710: adding unique index of column with duplicated
+# long values to reproduce error message with truncated key value.
+#
+
+CREATE TABLE t1 (c1 CHAR(255));
+INSERT INTO t1 VALUES (REPEAT("x", 255)), (REPEAT("x", 255));
+--error 1062
+ALTER TABLE t1 ADD UNIQUE (c1);
+DROP TABLE t1;
+
# End of 4.1 tests
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