No warning/error for unsupported index types
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
If I create a new index and specify a type which is not supported by the storage engine:
* the index is created using the default type;
* I get no error / warning.
For example, I tried to create a hash index for XtraDB:
MariaDB [test]> CREATE TABLE t5 (c1 INT) ENGINE = XtraDB;
Query OK, 0 rows affected, 2 warnings (0.08 sec)
MariaDB [test]> ALTER TABLE t5 ADD INDEX i1 (c1) USING hash;
Query OK, 0 rows affected (0.14 sec)
Records: 0 Duplicates: 0 Warnings: 0
MariaDB [test]> SHOW WARNINGS;
Empty set (0.00 sec)
MariaDB [test]> SHOW INDEX FROM t5;
+------
-------
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardi
nality | Sub_part | Packed | Null | Index_type | Comment |
+------
-------
| t5 | 1 | i1 | 1 | c1 | A |
NULL | NULL | NULL | YES | BTREE | |
+------
-------
1 row in set (0.00 sec)
MariaDB [test]>
This is documented MySQL behaviour:
http:// dev.mysql. com/doc/ refman/ 5.1/en/ create- index.html
"index_type"
"If you specify an index type that is not legal for a given storage engine, but there is another index type available that the engine can use without affecting query results, the engine uses the available type. "
On the other hand, if we receive a patch to generate a warning in this case, we might consider including it in MariaDB, as it seems a reasonable enough thing to do.