summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-02-17 16:13:42 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-02-17 16:13:42 +0400
commit4b260b668d66cfd6f7e8c2612461c66d2914219d (patch)
treebdbc73dd4f1984bcdae9fc74b5711cd70d3f2b34 /sql/item.cc
parent6cb7abe667533084e09f3df6951591332138ae0e (diff)
downloadmariadb-git-4b260b668d66cfd6f7e8c2612461c66d2914219d.tar.gz
Bug#33717 INSERT...(default) fails for enum. Crashes CSV tables, loads spaces for MyISAM
Table corruption happens during table reading in ha_tina::find_current_row() func. Field::store() method returns error(true) if stored value is 0. The fix: added special case for enum type which correctly processes 0 value. Additional fix: INSERT...(default) and INSERT...() have the same behaviour now for enum type. mysql-test/r/csv.result: test result mysql-test/r/default.result: result fix mysql-test/t/csv.test: test case sql/item.cc: Changes: do not print warning for 'enum' type if there is no default value. set default value. storage/csv/ha_tina.cc: Table corruption happens during table reading in ha_tina::find_current_row() func. Field::store() method returns error(true) if stored value is 0. The fix: added special case for enum type which correctly processes 0 value.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc
index df266434f72..f8cca3a0667 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -6488,7 +6488,8 @@ int Item_default_value::save_in_field(Field *field_arg, bool no_conversions)
{
if (!arg)
{
- if (field_arg->flags & NO_DEFAULT_VALUE_FLAG)
+ if (field_arg->flags & NO_DEFAULT_VALUE_FLAG &&
+ field_arg->real_type() != MYSQL_TYPE_ENUM)
{
if (field_arg->reset())
{