mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
sql_table.cc:
Bug#11657 Creation of secondary index fails: If TINYBLOB key part length is 255, it is equal to field length. For BLOB, unlike for CHAR/VARCHAR, we should keep a non-zero key part length, otherwise "BLOB/TEXT column used in key specification without a key length" error is produced afterwards. type_blob.result, type_blob.test: fixing tests accordinly sql/sql_table.cc: Bug#11657 Creation of secondary index fails For TINYBLOB key part length can be equal to field length. We should still keep a non-zero key part length, mysql-test/t/type_blob.test: fixing tests accordinly mysql-test/r/type_blob.result: fixing tests accordinly
This commit is contained in:
@ -3400,7 +3400,8 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
*/
|
||||
if (!Field::type_can_have_key_part(cfield->field->type()) ||
|
||||
!Field::type_can_have_key_part(cfield->sql_type) ||
|
||||
cfield->field->field_length == key_part_length ||
|
||||
(cfield->field->field_length == key_part_length &&
|
||||
!f_is_blob(key_part->key_type)) ||
|
||||
(cfield->length && (cfield->length < key_part_length /
|
||||
key_part->field->charset()->mbmaxlen)))
|
||||
key_part_length= 0; // Use whole field
|
||||
|
Reference in New Issue
Block a user