{"id":120,"date":"2008-06-14T16:36:39","date_gmt":"2008-06-14T20:36:39","guid":{"rendered":"http:\/\/antipaucity.com\/2008\/06\/14\/mysql-auto-changes-data-types\/"},"modified":"2008-06-14T16:36:39","modified_gmt":"2008-06-14T20:36:39","slug":"mysql-auto-changes-data-types","status":"publish","type":"post","link":"https:\/\/merikebi.warrenmyers.com\/?p=120","title":{"rendered":"mysql auto-changes data types"},"content":{"rendered":"<p>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.<\/p>\n<p>I don&#8217;t know if that&#8217;s supposed to happen, but it was serendipitous for me, as I wanted to change the char fields to varchar anyway.<\/p>\n<p>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.<\/p>\n<p>I didn&#8217;t see anything in a quick search on mysql&#8217;s website about this behavior, so it&#8217;s either undocumented, my google-fu is weak, or it&#8217;s a bug.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;t know if that&#8217;s supposed to happen, but it was &hellip;<br \/><a href=\"https:\/\/merikebi.warrenmyers.com\/?p=120\" class=\"more-link pen_button pen_element_default pen_icon_arrow_double\">Continue reading <span class=\"screen-reader-text\">mysql auto-changes data types<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[19,20,41],"tags":[],"keyring_services":[],"class_list":["post-120","post","type-post","status-publish","format-standard","hentry","category-hmmm","category-huh","category-technical"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=120"}],"version-history":[{"count":0,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=\/wp\/v2\/posts\/120\/revisions"}],"wp:attachment":[{"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=120"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/merikebi.warrenmyers.com\/index.php?rest_route=%2Fwp%2Fv2%2Fkeyring_services&post=120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}