Solution to: “database error Data too long for column”
-
I tried searching the web for a solution to this problem, and I can see a lot of other people are experiencing the same thing, without getting a lot of useful help.
My day-to-day browser is Firefox so I didn’t notice this earlier, but it has been brought to my attention that people using Internet Explorer to comment to my blog receive a database error. Once I was alerted I was able to verify this myself. Here is an example from a test post I made:
WordPress database error Data too long for column ‘comment_agent’ at row 1 for query INSERT INTO
wp_comments
(comment_post_ID
,comment_author
,comment_author_email
,comment_author_url
,comment_author_IP
,comment_date
,comment_date_gmt
,comment_content
,comment_karma
,comment_approved
,comment_agent
,comment_type
,comment_parent
,user_id
) VALUES (‘1523′,’Bill Hely’,’[email protected]’,”,’121.210.198.54′,’2009-12-19 08:21:12′,’2009-12-18 22:21:12′,’This is a test comment.’,’0′,’0′,’Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; THN_Toolbar; GTB6.3; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; FDM; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)’,”,’0′,’0′) made by wp_new_comment, wp_insert_commentIt would seem that WordPress doesn’t like the User Agent string being sent by Internet Explorer. As you can see my version of Internet Explorer is 8.0 (actually 8.0.6001.18702). The User Agent string of the person who first alerted me to this problem shows their version as 7.0b.
Both Firefox 3.5.6 and Google Chrome 3.0.195.38 allow comments normally without complaint.
Now, I have managed to circumvent this problem by changing the MySQL data type for comment_agent from VARCHAR(255) to TEXT, which I believe has a field size limit of 65,000 bytes.
A lot of bloggers who encounter this problem wouldn’t know how to analyse it, or how to implement the above fix.
It would be very useful to have a definitive comment from WordPress on this issue.
- The topic ‘Solution to: “database error Data too long for column”’ is closed to new replies.