Commit a9a362d3 authored by Sergei Golubchik's avatar Sergei Golubchik

Aria: test for ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN

Aria supports virtual columns, but does not support indexes
on virtual columns. Let's issue an appropriate error in this case.
parent 9d7c3cbe
create table t1 (a int, b int as (a+1), c int, index(b)) engine=aria;
ERROR HY000: Key/Index cannot be defined on a virtual generated column
--source include/have_maria.inc
--error ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN
create table t1 (a int, b int as (a+1), c int, index(b)) engine=aria;
......@@ -522,6 +522,14 @@ static int table2maria(TABLE *table_arg, data_file_type row_type,
for (j= 0; j < pos->user_defined_key_parts; j++)
{
Field *field= pos->key_part[j].field;
if (!table_arg->field[field->field_index]->stored_in_db())
{
my_free(*recinfo_out);
my_error(ER_KEY_BASED_ON_GENERATED_VIRTUAL_COLUMN, MYF(0));
DBUG_RETURN(HA_ERR_UNSUPPORTED);
}
type= field->key_type();
keydef[i].seg[j].flag= pos->key_part[j].key_part_flag;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment