mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#21505 Create view - illegal mix of collation for operation 'UNION'
The problem was that any VIEW columns had always implicit derivation. Fix: derivation is now copied from the original expression given in VIEW definition. For example: - a VIEW column which comes from a string constant in CREATE VIEW definition have now coercible derivation. - a VIEW column having COLLATE clause in CREATE VIEW definition have now explicit derivation.
This commit is contained in:

parent
9870d87f25
commit
aa1c8a5826
@ -8560,6 +8560,7 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table,
|
||||
item->collation.collation);
|
||||
else
|
||||
new_field= item->make_string_field(table);
|
||||
new_field->set_derivation(item->collation.derivation);
|
||||
break;
|
||||
case DECIMAL_RESULT:
|
||||
new_field= new Field_new_decimal(item->max_length, maybe_null, item->name,
|
||||
@ -8735,7 +8736,9 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
(make_copy_field ? 0 : copy_func),
|
||||
modify_item, convert_blob_length);
|
||||
case Item::TYPE_HOLDER:
|
||||
return ((Item_type_holder *)item)->make_field_by_type(table);
|
||||
result= ((Item_type_holder *)item)->make_field_by_type(table);
|
||||
result->set_derivation(item->collation.derivation);
|
||||
return result;
|
||||
default: // Dosen't have to be stored
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user