Friday, June 12, 2009

MySql Text Field - Truncating Data?

Every now and then you run an application that really tests the constraints of data types. I just encountered this....

I just found out that in MySql "BLOB TEXT A BLOB or TEXT column have a maximum length of 65535 (2^16 - 1) characters". I was encountering some data errors with large text chunks - and finally found that they were being truncated silently... When I counted the characters - yes... that was the issue.

Arggg!

But there is a simple solution... LONGTEXT or LONGBLOB fields can handle the larger bits of data - if this is expected. This gives you approx 4 Gig of space to work with. Good to know.

No comments:

Post a Comment