MDEV-18791 Wrong error upon creating Aria table with long index on BLOB

If we have long unique key for aria engine return too long key error, because
Aria does not support key on virtual generated column.
This commit is contained in:
Sachin Setiya 2019-10-08 17:35:09 +05:30 committed by Sachin
commit 5a6023cf6f
3 changed files with 13 additions and 0 deletions

View file

@ -265,3 +265,5 @@ ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con1;
connection default;
DROP TABLE t1, t2;
CREATE TABLE t1 (a TEXT, UNIQUE(a)) ENGINE=Aria;
ERROR 42000: Specified key was too long; max key length is 1000 bytes

View file

@ -317,3 +317,9 @@ INSERT IGNORE INTO t1 VALUES (4, 1)/*4*/;
--disconnect con1
--connection default
DROP TABLE t1, t2;
#
# MDEV-18791 Wrong error upon creating Aria table with long index on BLOB
#
--error ER_TOO_LONG_KEY
CREATE TABLE t1 (a TEXT, UNIQUE(a)) ENGINE=Aria;

View file

@ -554,6 +554,11 @@ static int table2maria(TABLE *table_arg, data_file_type row_type,
if (!table_arg->field[field->field_index]->stored_in_db())
{
my_free(*recinfo_out);
if (table_arg->s->long_unique_table)
{
my_error(ER_TOO_LONG_KEY, MYF(0), table_arg->file->max_key_length());
DBUG_RETURN(HA_ERR_INDEX_COL_TOO_LONG);
}
my_error(ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN, MYF(0));
DBUG_RETURN(HA_ERR_UNSUPPORTED);
}