Reputation:
Assuming I have a table with a TEXT
column, and there is data in it, what happens when I change that column from TEXT
to MEDIUMTEXT
, and is there something that I should be aware of or avoid?
Could there be any corruption or loss of data?
Note:
Upvotes: 2
Views: 1870
Reputation: 4523
You will have more characters allowed by row :
Type | Maximum length
-----------+-------------------------------------
TINYTEXT | 255 (2 8−1) bytes
TEXT | 65,535 (216−1) bytes = 64 KiB
MEDIUMTEXT | 16,777,215 (224−1) bytes = 16 MiB
LONGTEXT | 4,294,967,295 (232−1) bytes = 4 GiB
Upvotes: 1
Reputation: 15439
See the answer here for maximum sizes for different column types. Since you're changing from smaller to bigger type, you don't need to worry about truncation. It's a safe operation. Also, you very probably have no index on that column, so not much to worry about there either.
Upvotes: 1