List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:June 22 2005 7:46pm
Subject:bk commit into 5.0 tree (jimw:1.1994) BUG#11227
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1994 05/06/22 12:46:21 jimw@stripped +3 -0
  Fix reporting of type for unique key on VARCHAR field. (Bug #11227)

  sql/table.cc
    1.173 05/06/22 12:46:17 jimw@stripped +3 -4
    Use keyinfo->key_parts to determine if key is part of a
    multiple-field key or is unique.

  mysql-test/t/key.test
    1.21 05/06/22 12:46:17 jimw@stripped +16 -0
    Add new regression test

  mysql-test/r/key.result
    1.26 05/06/22 12:46:17 jimw@stripped +25 -0
    Add new results

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-11227

--- 1.172/sql/table.cc	2005-06-22 02:08:22 -07:00
+++ 1.173/sql/table.cc	2005-06-22 12:46:17 -07:00
@@ -701,10 +701,9 @@
             key_part->key_part_flag|= HA_BIT_PART;
 
 	  if (i == 0 && key != primary_key)
-	    field->flags |=
-	      ((keyinfo->flags & HA_NOSAME) &&
-	       field->key_length() ==
-	       keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG);
+	    field->flags |= ((keyinfo->flags & HA_NOSAME) &&
+                             (keyinfo->key_parts == 1)) ?
+                            UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG;
 	  if (i == 0)
 	    field->key_start.set_bit(key);
 	  if (field->key_length() == key_part->length &&

--- 1.25/mysql-test/r/key.result	2005-06-02 10:00:32 -07:00
+++ 1.26/mysql-test/r/key.result	2005-06-22 12:46:17 -07:00
@@ -354,3 +354,28 @@
   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;

--- 1.20/mysql-test/t/key.test	2005-06-02 10:00:32 -07:00
+++ 1.21/mysql-test/t/key.test	2005-06-22 12:46:17 -07:00
@@ -337,3 +337,19 @@
 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;
Thread
bk commit into 5.0 tree (jimw:1.1994) BUG#11227Jim Winstead22 Jun