mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 11:27:39 +02:00
MDEV-24511 null field is created with CREATE..SELECT
When creating fields for UNION results, Field_null is not allowed. Should create binary(0) instead.
This commit is contained in:
parent
c86f813afe
commit
6152ab7b42
5 changed files with 68 additions and 5 deletions
|
|
@ -5933,7 +5933,7 @@ void Type_handler_geometry::Item_param_set_param_func(Item_param *param,
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
bool Type_handler_string_result::union_element_finalize(const Item * item) const
|
||||
bool Type_handler_string_result::union_element_finalize(Item_type_holder *item) const
|
||||
{
|
||||
if (item->collation.derivation == DERIVATION_NONE)
|
||||
{
|
||||
|
|
@ -5943,6 +5943,12 @@ bool Type_handler_string_result::union_element_finalize(const Item * item) const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Type_handler_null::union_element_finalize(Item_type_holder *item) const
|
||||
{
|
||||
item->set_handler(&type_handler_string);
|
||||
return false;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
bool Type_handler::Vers_history_point_resolve_unit(THD *thd,
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ class Item_func_minus;
|
|||
class Item_func_mul;
|
||||
class Item_func_div;
|
||||
class Item_func_mod;
|
||||
class Item_type_holder;
|
||||
class cmp_item;
|
||||
class in_vector;
|
||||
class Type_handler_hybrid_field_type;
|
||||
|
|
@ -1191,7 +1192,7 @@ public:
|
|||
Performs the final data type validation for a UNION element,
|
||||
after the regular "aggregation for result" was done.
|
||||
*/
|
||||
virtual bool union_element_finalize(const Item * item) const
|
||||
virtual bool union_element_finalize(Item_type_holder *item) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -2244,7 +2245,7 @@ public:
|
|||
void sortlength(THD *thd,
|
||||
const Type_std_attributes *item,
|
||||
SORT_FIELD_ATTR *attr) const;
|
||||
bool union_element_finalize(const Item * item) const;
|
||||
bool union_element_finalize(Item_type_holder *item) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
|
|
@ -3118,6 +3119,7 @@ public:
|
|||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool union_element_finalize(Item_type_holder *item) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
|
|
|
|||
|
|
@ -1154,7 +1154,8 @@ cont:
|
|||
Test if the aggregated data type is OK for a UNION element.
|
||||
E.g. in case of string data, DERIVATION_NONE is not allowed.
|
||||
*/
|
||||
if (type->type_handler()->union_element_finalize(type))
|
||||
if (type->type() == Item::TYPE_HOLDER && type->type_handler()->
|
||||
union_element_finalize(static_cast<Item_type_holder*>(type)))
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue