Commit eb901ea4 authored by hf@deer.(none)'s avatar hf@deer.(none)

Proposed fix for #615

So now for the CREATE TABLE foo (id integer NOT NULL default 9)
INSERT INTO foo VALUES (NULL); we get an error
INSERT INTO foo VALUES (1), (NULL), (2); we get one warning
          and second record is set to 9

Is that what we want?
parent 10c81fb5
...@@ -121,6 +121,7 @@ set_field_to_null(Field *field) ...@@ -121,6 +121,7 @@ set_field_to_null(Field *field)
field->reset(); field->reset();
if (current_thd->count_cuted_fields) if (current_thd->count_cuted_fields)
{ {
field->set_default();
current_thd->cuted_fields++; // Increment error counter current_thd->cuted_fields++; // Increment error counter
return 0; return 0;
} }
...@@ -175,6 +176,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions) ...@@ -175,6 +176,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
return 0; // field is set in handler.cc return 0; // field is set in handler.cc
if (current_thd->count_cuted_fields) if (current_thd->count_cuted_fields)
{ {
field->set_default();
current_thd->cuted_fields++; // Increment error counter current_thd->cuted_fields++; // Increment error counter
return 0; return 0;
} }
......
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