I was making a change to a small table today: adding a field that wanted to be a varchar. The other fields that were of type char all magically changed to varchar when I was done with the alter statement that added one field.
I don’t know if that’s supposed to happen, but it was serendipitous for me, as I wanted to change the char fields to varchar anyway.
And, interestingly enough, if you have a table full of varchar fields and you try to add a char field, it will automatically switch it to match the varchar form, and not switch the varchars back to char.
I didn’t see anything in a quick search on mysql’s website about this behavior, so it’s either undocumented, my google-fu is weak, or it’s a bug.
Comment on “mysql auto-changes data types”
Comments are closed.