Reputation: 31
I'd like to convert a column format of my table from mediumtext to varchar because I want to define it as unique value column. If I try to do that, I get a positiv feedback from adminer as well as from phpmyadmin, but it shows the note/warning "Note 1246 Converting column 'URL' from VARCHAR to TEXT" and nothing happens.
The current values of the column respect the length restrictions of VARCHAR. Is there a possibility to force this change?
Upvotes: 0
Views: 993
Reputation: 142298
The limit for the entire index is 3072 bytes. Are you sure they will be shorter than that? If not, there are some clumsy ways to do it with an extra column containing md5
(or some other digest).
The error message may relate to VARCHAR
, not UNIQUE
. Note that the CHARACTER SET
factors into the limit.
SELECT MAX(LENGTH(url)) FROM tbl;
gave you a mere 158. Suggest you change the column to VARCHAR(191)
.
Upvotes: 0