MySQL Forums
Forum List  »  Docs

Re: text length in bytes or chars?
Posted by: KimSeong Loh
Date: September 08, 2005 07:07PM

For example, L+1 bytes to store a TINYTEXT value before MySQL 4.1 becomes L characters + 1 byte to store the length as of MySQL 4.1.

Do you mean TINYTEXT can holds 255 characters from 4.1 onwards?

It does not seem the case when I tested it, it holds 255 bytes only and not 255 characters, the difference occurs when multibyte character set is used for the TINYTEXT column, exampe utf8, the limits is 255 bytes and not 255 characters when characters longer than 1 byte is stored into the field.
Truncation occurs when I try to insert a string of 100 3-byte characters.

Truncation does not occur when I use VARCHAR(255), it can hold 100 3-byte characters with total byte length of 300 bytes.

Mixing the definition of bytes and characters is not good and confusing with multibyte characters. Maybe the table needs to be updated too. L is stated as bytes in CHAR and VARCHAR in the table.
http://dev.mysql.com/doc/mysql/en/storage-requirements.html

Options: ReplyQuote


Subject
Views
Written By
Posted
17315
September 04, 2005 07:55PM
7214
September 08, 2005 02:16PM
Re: text length in bytes or chars?
8003
September 08, 2005 07:07PM
4150
September 09, 2005 09:16AM
3947
September 11, 2005 08:48PM
3825
September 11, 2005 09:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.