summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-06-22 12:46:21 -0700
committerunknown <jimw@mysql.com>2005-06-22 12:46:21 -0700
commitd93705b83746b68d730e0c88bd3c21c58312fe6f (patch)
tree543baf0f88c15a91f035d35d565cf56621d5f115 /mysql-test
parentbbc0211304fe7beb47fef9f188e413effeea4470 (diff)
downloadmariadb-git-d93705b83746b68d730e0c88bd3c21c58312fe6f.tar.gz
Fix reporting of type for unique key on VARCHAR field. (Bug #11227)
mysql-test/r/key.result: Add new results mysql-test/t/key.test: Add new regression test sql/table.cc: Use keyinfo->key_parts to determine if key is part of a multiple-field key or is unique.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/key.result25
-rw-r--r--mysql-test/t/key.test16
2 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/r/key.result b/mysql-test/r/key.result
index 3ad8571aadd..bce02a1cb0f 100644
--- a/mysql-test/r/key.result
+++ b/mysql-test/r/key.result
@@ -354,3 +354,28 @@ t1 CREATE TABLE `t1` (
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
+create table t1 (a int not null primary key, b varchar(20) not null unique);
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO PRI
+b varchar(20) NO UNI
+drop table t1;
+create table t1 (a int not null primary key, b int not null unique);
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO PRI
+b int(11) NO UNI
+drop table t1;
+create table t1 (a int not null primary key, b varchar(20) not null, unique (b(10)));
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO PRI
+b varchar(20) NO UNI
+drop table t1;
+create table t1 (a int not null primary key, b varchar(20) not null, c varchar(20) not null, unique(b(10),c(10)));
+desc t1;
+Field Type Null Key Default Extra
+a int(11) NO PRI
+b varchar(20) NO MUL
+c varchar(20) NO
+drop table t1;
diff --git a/mysql-test/t/key.test b/mysql-test/t/key.test
index 9db1523be51..96407a3d1bc 100644
--- a/mysql-test/t/key.test
+++ b/mysql-test/t/key.test
@@ -337,3 +337,19 @@ show create table t1;
alter table t1 modify a varchar(20);
show create table t1;
drop table t1;
+
+#
+# Bug #11227: Incorrectly reporting 'MUL' vs. 'UNI' on varchar
+#
+create table t1 (a int not null primary key, b varchar(20) not null unique);
+desc t1;
+drop table t1;
+create table t1 (a int not null primary key, b int not null unique);
+desc t1;
+drop table t1;
+create table t1 (a int not null primary key, b varchar(20) not null, unique (b(10)));
+desc t1;
+drop table t1;
+create table t1 (a int not null primary key, b varchar(20) not null, c varchar(20) not null, unique(b(10),c(10)));
+desc t1;
+drop table t1;