What happens if I drop a MySQL column without dropping its index first?

前端 未结 1 1997
死守一世寂寞
死守一世寂寞 2020-12-17 08:31

With one of my MySQL tables, I dropped column col1 before I drop it from a unique index (col0, col1, col2, col3) that contains it.

Is it automatical

1条回答
  •  我在风中等你
    2020-12-17 09:13

    According to the MySQL 5.1 Reference Manual:

    If columns are dropped from a table, the columns are also removed from any index of which they are a part. If all columns that make up an index are dropped, the index is dropped as well. If you use CHANGE or MODIFY to shorten a column for which an index exists on the column, and the resulting column length is less than the index length, MySQL shortens the index automatically.

    0 讨论(0)
提交回复
热议问题