[development] Form field maxlengths vs. database field sizes
Karthik
narakasura at gmail.com
Sun Feb 12 08:13:57 UTC 2006
> The problem is inconsistency across mysql versions. On MySQL 4.1+ (and
> w/ drupal 4.7), database field sizes are counted in characters. On 4.0
> and below, they are in bytes. So for a varchar(256) we could have from
> 64 to 256 characters (4 to 1 bytes per character) with UTF-8. Should we
> set the maxlength to 64 then? We settled on the compromise of half (128)
> on the assumption that most people use 1-2 byte characters.
>
> Once we phase out MySQL 4.0 we can safely make them all match the
> database sizes.
>
> Steven
But where all should these guidelines be implemented? This affects any
VARCHAR field from node titles (128) to usernames (60) and would
effectively restricts (for e.g.) node title lengths to 64 characters?
Won't it be better to just follow database field sizes and recommend
users requiring multi-byte support to upgrade to 4.1+ for best
results? This would allow for the greatest degree of consistency and
the least amount of hassle.
How about pgSQL?
Thanks
-K
More information about the development
mailing list