[MDEV-790] LP:519691 - No warning/error for unsupported index types Created: 2010-02-10  Updated: 2018-11-22

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Federico (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug519691.xml    

 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]>



 Comments   
Comment by Kristian Nielsen [ 2010-02-11 ]

Re: No warning/error for unsupported index types
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.

Comment by Rasmus Johansson (Inactive) [ 2010-02-11 ]

Launchpad bug id: 519691

Comment by Sergei Golubchik [ 2015-03-06 ]

There is IGNORE_BAD_TABLE_OPTIONS sql mode, which logically could apply here too.

But by default we do not "ignore bad table options" and this sql mode enables a relaxed behavior.
With indexes it's historically the opposite, the relaxed behavior is the default.

Suggestion: change the default to be strict and let IGNORE_BAD_TABLE_OPTIONS control it.

Comment by Ian Gilfillan [ 2018-03-16 ]

Agree with serg's suggestion.

Generated at Thu Feb 08 06:31:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.