From: Paul DuBois Date: September 11 2006 6:08pm Subject: Re: Varchar mystery List-Archive: http://lists.mysql.com/mysql/201770 Message-Id: <4505A62B.9040707@mysql.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Jerry Schwartz wrote: > I'm using MySQL Linux version 4.1.21 standard. > > I have a table with fields of a variety of types, including varchar(255) and > text (which might matter). When I do > > SELECT MAX(LENGTH(x)) FROM tx; > > where x is a varchar(255), I get back 266 as the result of the query! > > This isn't listed as one of the silent conversions - varchar(256) would be > converted to text, but not varchar(255). What's going on? Perhaps you are using multi-byte characters? LENGTH() returns a length in bytes. CHAR_LENGTH() returns the length in characters.