Commit 500192ae authored by vva@eagle.mysql.r18.ru's avatar vva@eagle.mysql.r18.ru

Merge vvagin@bk-internal.mysql.com:/home/bk/mysql-4.0

into eagle.mysql.r18.ru:/home/vva/work/BUG_2023/mysql-4.0
parents b4f34fdd 5eb8fa9e
...@@ -1636,3 +1636,13 @@ t1 CREATE TABLE `t1` ( ...@@ -1636,3 +1636,13 @@ t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default 'b' `a` enum('','a','b') NOT NULL default 'b'
) TYPE=MyISAM ) TYPE=MyISAM
drop table t1; drop table t1;
create table t1 (a enum ('0','1'));
insert into t1 set a='foobar';
select * from t1;
a
update t1 set a = replace(a,'x','y');
select * from t1;
a
drop table t1;
...@@ -21,3 +21,14 @@ drop table t1; ...@@ -21,3 +21,14 @@ drop table t1;
create table t1 (a enum (' ','a','b ') not null default 'b '); create table t1 (a enum (' ','a','b ') not null default 'b ');
show create table t1; show create table t1;
drop table t1; drop table t1;
#
# Tests of wrong enum values (bug #2023)
#
create table t1 (a enum ('0','1'));
insert into t1 set a='foobar';
select * from t1;
update t1 set a = replace(a,'x','y');
select * from t1;
drop table t1;
\ No newline at end of file
...@@ -4623,7 +4623,7 @@ void Field_enum::store(const char *from,uint length) ...@@ -4623,7 +4623,7 @@ void Field_enum::store(const char *from,uint length)
uint tmp=find_enum(typelib,from,length); uint tmp=find_enum(typelib,from,length);
if (!tmp) if (!tmp)
{ {
if (length < 6) // Can't be more than 99999 enums if (length < 6) // Can't be more than 99999 enums
{ {
/* This is for reading numbers with LOAD DATA INFILE */ /* This is for reading numbers with LOAD DATA INFILE */
char buff[7], *end; char buff[7], *end;
...@@ -4721,7 +4721,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)), ...@@ -4721,7 +4721,7 @@ String *Field_enum::val_str(String *val_buffer __attribute__((unused)),
{ {
uint tmp=(uint) Field_enum::val_int(); uint tmp=(uint) Field_enum::val_int();
if (!tmp || tmp > typelib->count) if (!tmp || tmp > typelib->count)
val_ptr->length(0); val_ptr->set((char*)"",0);
else else
val_ptr->set((const char*) typelib->type_names[tmp-1], val_ptr->set((const char*) typelib->type_names[tmp-1],
(uint) strlen(typelib->type_names[tmp-1])); (uint) strlen(typelib->type_names[tmp-1]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment