[MDEV-10153] MariaDB allows creation of duplicate indexes with identical definitions Created: 2016-05-30 Updated: 2023-04-27 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Minor |
| Reporter: | nick ivanov | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | ddl, index, innodb | ||
| Description |
|
One is allowed to create multiple indexes with identical definitions. For example, the following leads to creation of 4 separate indexes on the same column.
Ideally, you should be allowed to create only one index with a given combination and order of columns, and constraints should reuse matching indexes instead of creating new ones. |
| Comments |
| Comment by nick ivanov [ 2016-05-30 ] | |
|
There is a warning (code 1831) issued for exactly duplicate indexes (e.g. ix1 and ix2) in the example, but no warning for the duplication of the primary key and identical unique index, and no warning for the duplication of ix2 (unique) and ix3 (non-unique). | |
| Comment by Marko Mäkelä [ 2018-05-24 ] | |
|
On a related note, yesterday I noticed that
would create 2 indexes inside InnoDB. SERIAL should roughly be an alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY. |