summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/field.h8
-rw-r--r--sql/field_conv.cc3
2 files changed, 10 insertions, 1 deletions
diff --git a/sql/field.h b/sql/field.h
index 304e75494e2..9c2cd52cfa5 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1906,7 +1906,13 @@ public:
int store(longlong nr, bool unsigned_val);
int store_decimal(const my_decimal *);
uint size_of() const { return sizeof(*this); }
- int reset(void) { return !maybe_null() || Field_blob::reset(); }
+
+ /**
+ Non-nullable GEOMETRY types cannot have defaults,
+ but the underlying blob must still be reset.
+ */
+ int reset(void) { return Field_blob::reset() || !maybe_null(); }
+
geometry_type get_geometry_type() { return geom_type; };
};
#endif /*HAVE_SPATIAL*/
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index 3890fe395d7..1a3ac9de08b 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -178,7 +178,10 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
((Field_timestamp*) field)->set_time();
return 0; // Ok to set time to NULL
}
+
+ // Note: we ignore any potential failure of reset() here.
field->reset();
+
if (field == field->table->next_number_field)
{
field->table->auto_increment_field_not_null= FALSE;