I tried to manually reproduce the warning by creating a regular and a unique index on the same columns, but MariaDB 10.6.8 would only complain if both were either regular indexes or a both unique indexes.
In any case a unique index is more specific and should be all you need. In the referenced case of Nova (https://bugs.launchpad.net/nova/+bug/1641185) there it's actually two unique indexes being created on the exact same column "uuid" (no pun intended).
Hey Brian,
well the warning originates from MySQL/MariaDB, see https:/ /mariadb. com/docs/ reference/ mdb/error- codes/ER_ DUP_INDEX/ or "1831" on https:/ /mariadb. com/kb/ en/mariadb- error-codes/. It just happen during DDL SQL statements modifing the schemas, but it's actually just MariaDB complaining.
I tried to manually reproduce the warning by creating a regular and a unique index on the same columns, but MariaDB 10.6.8 would only complain if both were either regular indexes or a both unique indexes.
In any case a unique index is more specific and should be all you need. In the referenced case of Nova (https:/ /bugs.launchpad .net/nova/ +bug/1641185) there it's actually two unique indexes being created on the exact same column "uuid" (no pun intended).
If you look at their code at https:/ /opendev. org/openstack/ nova/src/ commit/ c53ec4e48884235 566962bc934cbf2 92ad5b67b8/ nova/db/ main/models. py#L269 they simply marked the column as unique in the first place and did also add a unique index.
Maybe it's cleaner code to just mark a column unique and don't bother with an additional constraint?
Would you consider dropping the additional index in the neutron case then?