1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-34376 Wrong data types when mixing an utf8 *TEXT column and a short binary

A mixture of a multi-byte *TEXT column and a short binary column
produced a too large column.
For example, COALESCE(tinytext_utf8mb4, short_varbinary)
produced a BLOB column instead of an expected TINYBLOB.

- Adding a virtual method Type_all_attributes::character_octet_length(),
  returning max_length by default.
- Overriding Item_field::character_octet_length() to extract
  the octet length from the underlying Field.
- Overriding Item_ref::character_octet_length() to extract
  the octet length from the references Item (e.g. as VIEW fields).
- Fixing Type_numeric_attributes::find_max_octet_length() to
  take the octet length using the new method character_octet_length()
  instead of accessing max_length directly.
This commit is contained in:
Alexander Barkov
2024-06-12 16:53:15 +04:00
parent c83ba513da
commit 0e27351028
5 changed files with 228 additions and 1 deletions

View File

@ -1221,7 +1221,7 @@ uint32 Type_numeric_attributes::find_max_octet_length(Item **item, uint nitems)
{
uint32 octet_length= 0;
for (uint i= 0; i < nitems ; i++)
set_if_bigger(octet_length, item[i]->max_length);
set_if_bigger(octet_length, item[i]->character_octet_length());
return octet_length;
}