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

@ -3345,6 +3345,7 @@ public:
{ }
virtual ~Type_all_attributes() = default;
virtual void set_maybe_null(bool maybe_null_arg)= 0;
virtual uint32 character_octet_length() const { return max_length; }
// Returns total number of decimal digits
virtual uint decimal_precision() const= 0;
virtual const TYPELIB *get_typelib() const= 0;