Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
This code in mysql_prepare_create_table() is not friendly to data type plugins:
/* Use packed keys for long strings on the first column */ |
if (!((*db_options) & HA_OPTION_NO_PACK_KEYS) && |
!((create_info->table_options & HA_OPTION_NO_PACK_KEYS)) &&
|
(key_part_length >= KEY_DEFAULT_PACK_LENGTH &&
|
(sql_field->real_field_type() == MYSQL_TYPE_STRING ||
|
sql_field->real_field_type() == MYSQL_TYPE_VARCHAR ||
|
f_is_blob(sql_field->pack_flag))) && !is_hash_field_needed)
|
{
|
if ((column_nr == 0 && f_is_blob(sql_field->pack_flag)) || |
sql_field->real_field_type() == MYSQL_TYPE_VARCHAR)
|
key_info->flags|= HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY;
|
else |
key_info->flags|= HA_PACK_KEY;
|
}
|
Let's add a new method in Type_handler:
virtual ulong KEY_pack_flags(uint column_nr) const { return 0; } |
So the above code will change to:
/* Use packed keys for long strings on the first column */ |
if (!((*db_options) & HA_OPTION_NO_PACK_KEYS) && |
!((create_info->table_options & HA_OPTION_NO_PACK_KEYS)) &&
|
(key_part_length >= KEY_DEFAULT_PACK_LENGTH) &&
|
!is_hash_field_needed)
|
{
|
key_info->flags|= sql_field->type_handler()->KEY_pack_flags(column_nr);
|
}
|
Data type plugins will be able to override this method.
Attachments
Issue Links
- blocks
-
MDEV-274 The data type for IPv6/IPv4 addresses in MariaDB
- Closed
-
MDEV-4912 Data type plugin API version 1
- Closed
- causes
-
MDEV-28822 Table from older version requires table rebuild when adding column to table with multi-column index
- Closed
- relates to
-
MDEV-28822 Table from older version requires table rebuild when adding column to table with multi-column index
- Closed