Commit 712326d6 authored by unknown's avatar unknown
Browse files

Bug#6202: ENUMs are not case sensitive even if declared BINARY

parent 7df41480
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ typedef struct st_typelib { /* Different types saved here */
  unsigned int count;		/* How many types */
  const char *name;		/* Name of typelib */
  const char **type_names;
  unsigned int *type_lengths;
} TYPELIB;

extern int find_type(char *x,TYPELIB *typelib,unsigned int full_name);
+18 −0
Original line number Diff line number Diff line
@@ -1677,3 +1677,21 @@ Field Type Null Key Default Extra
a	int(11)	YES		1	
b	enum('value','_value','')			value	
drop table t1;
CREATE TABLE t1 (c enum('a', 'A') BINARY);
Warnings:
Note	1291	Column 'c' has duplicated value 'a' in ENUM
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1;
c
a
A
DROP TABLE t1;
CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES (''),(''),(''),('');
SELECT * FROM t1;
c
ae
oe
ue
ss
DROP TABLE t1;
+13 −0
Original line number Diff line number Diff line
@@ -59,3 +59,16 @@ CREATE TABLE t1 (
show create table t1;
show columns from t1;
drop table t1;

#
# Bugs #6154, 6206: ENUMs are not case sensitive even if declared BINARY
#
CREATE TABLE t1 (c enum('a', 'A') BINARY);
INSERT INTO t1 VALUES ('a'),('A');
SELECT * FROM t1;
DROP TABLE t1;

CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES (''),(''),(''),('');
SELECT * FROM t1;
DROP TABLE t1;
+1 −1
Original line number Diff line number Diff line
@@ -5514,7 +5514,7 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
  /* Remove end space */
  while (length > 0 && my_isspace(system_charset_info,from[length-1]))
    length--;
  uint tmp=find_type(typelib, from, length, 0);
  uint tmp=find_type2(typelib, from, length, field_charset);
  if (!tmp)
  {
    if (length < 6) // Can't be more than 99999 enums
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ const char *berkeley_lock_names[] =
u_int32_t berkeley_lock_types[]=
{ DB_LOCK_DEFAULT, DB_LOCK_OLDEST, DB_LOCK_RANDOM };
TYPELIB berkeley_lock_typelib= {array_elements(berkeley_lock_names)-1,"",
				berkeley_lock_names};
				berkeley_lock_names, NULL};

static void berkeley_print_error(const char *db_errpfx, char *buffer);
static byte* bdb_get_key(BDB_SHARE *share,uint *length,
Loading