diff options
author | unknown <igor@olga.mysql.com> | 2007-07-22 18:26:16 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-07-22 18:26:16 -0700 |
commit | d50caace5fa82b2281f5118c49f6754609d51ba9 (patch) | |
tree | 8638b7ea7fd40550d394c0c24efe37926c8b09be /sql/field.cc | |
parent | 240bb90ef1ed1bcde9a3420fe790a17bd4d45ee7 (diff) | |
download | mariadb-git-d50caace5fa82b2281f5118c49f6754609d51ba9.tar.gz |
Fixed bug #29611.
If a primary key is defined over column c of enum type then
the EXPLAIN command for a look-up query of the form
SELECT * FROM t WHERE c=0
said that the query was with an impossible where condition though the
query correctly returned non-empty result set when the table indeed
contained rows with error empty strings for column c.
This kind of misbehavior was due to a bug in the function
Field_enum::store(longlong,bool) that erroneously returned 1 if
the the value to be stored was equal to 0.
Note that the method
Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
correctly returned 0 if a value of the error empty string
was stored.
mysql-test/r/type_enum.result:
Added a test case for bug #29661.
mysql-test/t/type_enum.test:
Added a test case for bug #29661.
sql/field.cc:
Fixed bug #29611.
If a primary key was defined over column c of enum type then
the EXPLAIN command for a look-up query of the form
SELECT * FROM t WHERE c=0
said that the query was with an impossible where condition though the
query correctly returned non-empty result set when the table indeed
contained rows with error empty strings for column c.
This kind of misbehavior was due to a bug in the function
Field_enum::store(longlong,bool) that erroneously returned 1 if
the the value to be stored was equal to 0.
Note that the method
Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
correctly returned 0 if a value of the error empty string
was stored.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index 993c1fb3c4f..4a1320af48c 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7640,8 +7640,11 @@ int Field_enum::store(longlong nr, bool unsigned_val) if ((ulonglong) nr > typelib->count || nr == 0) { set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); - nr=0; - error=1; + if (nr != 0 || table->in_use->count_cuted_fields) + { + nr= 0; + error= 1; + } } store_type((ulonglong) (uint) nr); return error; |