Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-790

LP:519691 - No warning/error for unsupported index types

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Fix Version/s: 10.1
    • Component/s: None
    • Labels:

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

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            knielsen Kristian Nielsen added a comment -

            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.

            Show
            knielsen Kristian Nielsen added a comment - 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.
            Hide
            ratzpo Rasmus Johansson added a comment -

            Launchpad bug id: 519691

            Show
            ratzpo Rasmus Johansson added a comment - Launchpad bug id: 519691
            Hide
            serg Sergei Golubchik added a comment -

            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.

            Show
            serg Sergei Golubchik added a comment - 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.

              People

              • Assignee:
                Unassigned
                Reporter:
                federico Federico
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: