diff options
author | mhansson/martin@linux-st28.site <> | 2007-12-11 20:15:03 +0100 |
---|---|---|
committer | mhansson/martin@linux-st28.site <> | 2007-12-11 20:15:03 +0100 |
commit | 867a78654946c7c7ebed430b2b8437e837a0455d (patch) | |
tree | 9615a0eaca93ca19b59f1a93f0a77b7875a88468 /sql/field.cc | |
parent | 7f67efccef94449ef6c797583a2695b27a9b7376 (diff) | |
download | mariadb-git-867a78654946c7c7ebed430b2b8437e837a0455d.tar.gz |
Bug#32848: Data type conversion bug in union subselects in MySQL 5.0.38
There were two problems when inferring the correct field types resulting from
UNION queries.
- If the type is NULL for all corresponding fields in the UNION, the resulting
type would be NULL, while the type is BINARY(0) if there is just a single
SELECT NULL.
- If one SELECT in the UNION uses a subselect, a temporary table is created
to represent the subselect, and the result type defaults to a STRING type,
hiding the fact that the type was unknown(just a NULL value).
Fixed by remembering whenever a field was created from a NULL value and pass
type NULL to the type coercion if that is the case, and creating a string field
as result of UNION only if the type would otherwise be NULL.
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc index e6e4195ba1e..1a0e93c82ac 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -1304,7 +1304,8 @@ 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), + is_created_from_null_item(FALSE) { flags=null_ptr ? 0: NOT_NULL_FLAG; comment.str= (char*) ""; |