Download & Extend

user warning: Data too long for column 'maxstring'

Project:Table Wizard
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

After adding a couple of tables I get something like that

Data too long for column 'maxstring' at row 1 query: INSERT INTO tw_columns (twtid, colname, weight, primarykey, availablefk, secure, ignorecol, isempty, coltype, minlength, maxlength, minstring, maxstring) VALUES (20, 'Event_Details', 11, 0, 0, 0, 0, 0, 'text', 0, 19088, '', 'On Saturday 7 July&
(i cut the message)

So this field (Event_Details) does not appear in the table. This happens with all fields that have text, even when i tried to analyze a default drupal's table in which again I took the same error for the teaser field. As I've seen maxstring has 255 length so the error makes sense... but the behavior doesn't:)

Comments

#1

Status:active» postponed (maintainer needs more info)

I tried this, adding a table with an 860-character text field, and it truncated silently when added to tw_columns. Is there any more info you can give me? Any more to the message following the long text? What version of MySQL are you using? What version of Drupal?

Thanks.

#2

Status:postponed (maintainer needs more info)» closed (fixed)

No other reports, no further information provided.

#3

I had a similar error and it was a character this one

·

at the start of a text field - i deleted it and and re imported fine.

#4

Status:closed (fixed)» active

@shambler, thanks for providing that info - it's the clue we've needed all along, presumably something to do with multi-byte characters...

#5

Status:active» needs review

Could someone experiencing the issue try the attached patch? I'm not sure this will necessarily fix the problem it seems like it maybe deeper...

Thanks.

AttachmentSize
tw_length.patch 815 bytes

#6

I have not dug into the code too much, but the Table tw_columns has a field called "maxstring" that was a varchar(255). It looks like this field stores the largest string found for the field. Since some people will be importing blob or text type fields I would think "maxstring" should be a "text" field. Changing it to text worked for me. I am not sure if this will create any problems, but if fixes the issue at hand.

#7

Did you try the patch in the previous comment? It makes sure the min/max strings are truncated to 255 characters before being stored.

#8

Status:needs review» fixed

The patch in #5 was committed long ago.

#9

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here