diff options
author | unknown <mhansson/martin@linux-st28.site> | 2007-12-21 14:52:39 +0100 |
---|---|---|
committer | unknown <mhansson/martin@linux-st28.site> | 2007-12-21 14:52:39 +0100 |
commit | baf5c2c132f498df72c5c8196d591481e03b9fee (patch) | |
tree | 4db05ce0abde8a41b21fcb0c65c94ab0635b8952 /sql | |
parent | 3a13408f8547b0f15952b8fd909bcc527910cc1a (diff) | |
parent | fbb25b7cecf468eb4e422e22cd3aa2da4ba0fa8a (diff) | |
download | mariadb-git-baf5c2c132f498df72c5c8196d591481e03b9fee.tar.gz |
Merge mhansson@bk-internal:/home/bk/mysql-5.1-opt
into linux-st28.site:/home/martin/mysql/src/bug32848/my51-bug32848
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/item.cc:
Auto merged
sql/sql_select.cc:
Auto merged
mysql-test/r/union.result:
Bug#32848: Manual merge
mysql-test/t/union.test:
Bug#32848: Manual merge
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 3 | ||||
-rw-r--r-- | sql/field.h | 10 | ||||
-rw-r--r-- | sql/item.cc | 4 | ||||
-rw-r--r-- | sql/sql_select.cc | 2 |
4 files changed, 18 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc index 52168e713aa..668ced4a229 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1307,7 +1307,8 @@ Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, field_name(field_name_arg), key_start(0), part_of_key(0), part_of_key_not_clustered(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), + is_created_from_null_item(FALSE) { flags=null_ptr ? 0: NOT_NULL_FLAG; comment.str= (char*) ""; diff --git a/sql/field.h b/sql/field.h index 27be2601270..dc4f1b13cb5 100644 --- a/sql/field.h +++ b/sql/field.h @@ -90,6 +90,16 @@ public: uint32 flags; uint16 field_index; // field number in fields array uchar null_bit; // Bit used to test null bit + /** + If true, this field was created in create_tmp_field_from_item from a NULL + value. This means that the type of the field is just a guess, and the type + may be freely coerced to another type. + + @see create_tmp_field_from_item + @see Item_type_holder::get_real_type + + */ + bool is_created_from_null_item; Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, diff --git a/sql/item.cc b/sql/item.cc index 4d579597d21..a8b17a5ca12 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6707,6 +6707,8 @@ enum_field_types Item_type_holder::get_real_type(Item *item) */ Field *field= ((Item_field *) item)->field; enum_field_types type= field->real_type(); + if (field->is_created_from_null_item) + return MYSQL_TYPE_NULL; /* work around about varchar type field detection */ if (type == MYSQL_TYPE_STRING && field->type() == MYSQL_TYPE_VAR_STRING) return MYSQL_TYPE_VAR_STRING; @@ -6965,6 +6967,8 @@ Field *Item_type_holder::make_field_by_type(TABLE *table) if (field) field->init(table); return field; + case MYSQL_TYPE_NULL: + return make_string_field(table); default: break; } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3a142568080..741e8afec1d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9277,6 +9277,8 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, *((*copy_func)++) = item; // Save for copy_funcs if (modify_item) item->set_result_field(new_field); + if (item->type() == Item::NULL_ITEM) + new_field->is_created_from_null_item= TRUE; return new_field; } |