diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 3 | ||||
-rw-r--r-- | sql/field.h | 5 | ||||
-rw-r--r-- | sql/sql_select.cc | 3 |
3 files changed, 9 insertions, 2 deletions
diff --git a/sql/field.cc b/sql/field.cc index 18105b31f97..c31fbacc25e 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1228,12 +1228,11 @@ Field::Field(char *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, field_name(field_name_arg), query_id(0), key_start(0), part_of_key(0), part_of_sortkey(0), unireg_check(unireg_check_arg), - field_length(length_arg),null_bit(null_bit_arg) + field_length(length_arg), null_bit(null_bit_arg), dflt_field(0) { flags=null_ptr ? 0: NOT_NULL_FLAG; comment.str= (char*) ""; comment.length=0; - dflt_field= 0; } uint Field::offset() diff --git a/sql/field.h b/sql/field.h index 1801f0d0f86..4c3f6cd0709 100644 --- a/sql/field.h +++ b/sql/field.h @@ -53,6 +53,11 @@ public: char *ptr; // Position to field in record uchar *null_ptr; // Byte where null_bit is + /* + dflt_field is used only for the fields of temporary tables. + It points to the default value of the field in another table + from which this field has been created. + */ Field *dflt_field; // Field to copy default value from /* Note that you can use table->in_use as replacement for current_thd member diff --git a/sql/sql_select.cc b/sql/sql_select.cc index b278b4ac167..1fe1747c44f 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8697,7 +8697,10 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, if (is_null) field->set_null(); else + { + field->set_notnull(); memcpy(field->ptr, from, field->pack_length()); + } } if (from_field[i]) |