Commit 5465a148 authored by unknown's avatar unknown

Fix for Bug#17888 DD: ADD INDEX causes error 756 'Index on disk column is not supported

parent 7464c9f3
......@@ -175,7 +175,7 @@ CREATE TABLE t1
(pk1 INT NOT NULL PRIMARY KEY, b INT NOT NULL, c INT NOT NULL)
TABLESPACE ts1 STORAGE DISK
ENGINE NDB;
CREATE INDEX c on t1(c);
CREATE INDEX c on t1(b, c);
DROP TABLE t1;
ALTER TABLESPACE ts1
DROP DATAFILE 'datafile2.dat'
......
......@@ -263,7 +263,7 @@ CREATE TABLE t1
TABLESPACE ts1 STORAGE DISK
ENGINE NDB;
CREATE INDEX c on t1(c);
CREATE INDEX c on t1(b, c);
DROP TABLE t1;
......
......@@ -3706,6 +3706,8 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
uint changes= 0, tmp;
List_iterator_fast<create_field> new_field_it(*create_list);
create_field *new_field;
KEY_PART_INFO *key_part;
KEY_PART_INFO *end;
DBUG_ENTER("compare_tables");
/*
......@@ -3833,9 +3835,14 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
/* Key modified. Add the offset of the key to both buffers. */
index_drop_buffer[(*index_drop_count)++]= table_key - table->key_info;
index_add_buffer[(*index_add_count)++]= new_key - key_info_buffer;
field= table->field[new_key->key_part->fieldnr];
key_part= new_key->key_part;
end= key_part + new_key->key_parts;
for(; key_part != end; key_part++)
{
// Mark field to be part of new key
field= table->field[key_part->fieldnr];
field->add_index= 1;
}
DBUG_PRINT("info", ("index changed: '%s'", table_key->name));
}
/*end of for (; table_key < table_key_end;) */
......@@ -3855,9 +3862,14 @@ static uint compare_tables(TABLE *table, List<create_field> *create_list,
{
/* Key not found. Add the offset of the key to the add buffer. */
index_add_buffer[(*index_add_count)++]= new_key - key_info_buffer;
field= table->field[new_key->key_part->fieldnr];
key_part= new_key->key_part;
end= key_part + new_key->key_parts;
for(; key_part != end; key_part++)
{
// Mark field to be part of new key
field= table->field[key_part->fieldnr];
field->add_index= 1;
}
DBUG_PRINT("info", ("index added: '%s'", new_key->name));
}
}
......
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