summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <vva@eagle.mysql.r18.ru>2003-12-12 21:26:44 -0400
committerunknown <vva@eagle.mysql.r18.ru>2003-12-12 21:26:44 -0400
commit51c54cd7744103b4876c61dca3662ed91d3a8dea (patch)
tree5d3eb4c08cbcee1b1e4e6e7c4706374777c07a0d
parent22c12eaeb296b55d6121531bea44a97fb5297f04 (diff)
downloadmariadb-git-51c54cd7744103b4876c61dca3662ed91d3a8dea.tar.gz
added checking for old cuted value in Field_enum::store
(bug #2023) mysql-test/r/type_enum.result: added tests for wrong enum values (bug #2023) mysql-test/t/type_enum.test: added tests for wrong enum values (bug #2023)
-rw-r--r--mysql-test/r/type_enum.result10
-rw-r--r--mysql-test/t/type_enum.test11
-rw-r--r--sql/field.cc2
3 files changed, 22 insertions, 1 deletions
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index ee3bd077798..03cfdc3c286 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1636,3 +1636,13 @@ t1 CREATE TABLE `t1` (
`a` enum('','a','b') NOT NULL default 'b'
) TYPE=MyISAM
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;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index 8f399e4364e..78b850b6ea6 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -21,3 +21,14 @@ drop table t1;
create table t1 (a enum (' ','a','b ') not null default 'b ');
show create 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
diff --git a/sql/field.cc b/sql/field.cc
index d43089ec35c..a2734835cf9 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4623,7 +4623,7 @@ void Field_enum::store(const char *from,uint length)
uint tmp=find_enum(typelib,from,length);
if (!tmp)
{
- if (length < 6) // Can't be more than 99999 enums
+ if (from && length < 6) // Can't be more than 99999 enums
{
/* This is for reading numbers with LOAD DATA INFILE */
char buff[7], *end;