Bug #118853 Wrong description for TEXT datatype (and its variants) maximum length in the refman.
Submitted: 19 Aug 9:58 Modified: 19 Aug 11:32
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:8.0.43, 8.4.5, 9.4.0 OS:Any
Assigned to: CPU Architecture:Any

[19 Aug 9:58] Tsubasa Tanaka
Description:
This is documentation issue.

There is a description about TEXT type maximum length in the refman.

> TEXT[(M)] [CHARACTER SET charset_name] [COLLATE collation_name]
> A TEXT column with a maximum length of 65,535 (216 − 1) characters. The effective maximum length is less if the value contains multibyte characters. Each TEXT value is stored using a 2-byte length prefix that indicates the number of bytes in the value.

https://dev.mysql.com/doc/refman/9.4/en/string-type-syntax.html

By the way, the TEXT type maximum length is limited by 65,535 "bytes", not 65,535 "characters" .

How to repeat:
CREATE DATABASE d1;
use d1
CREATE TABLE t1 (txt TEXT);

mysql> INSERT INTO t1 VALUES(REPEAT(0xF09F8DA3, 65535));  -- 0xF09F8DA3 = '🍣', can't fit in 65535 characters.
ERROR 1406 (22001): Data too long for column 'txt' at row 1

mysql> INSERT INTO t1 VALUES(REPEAT(0xF09F8DA3, 16383));  -- 16383 * 4 = 65532 is less than 65535 bytes. This INSERT succeeds.
Query OK, 1 row affected (0.009 sec)

mysql> INSERT INTO t1 VALUES(REPEAT(0xF09F8DA3, 16384)); -- 16384 * 4 = 65536 is greater than 65535 bytes, This INSERT fails.
ERROR 1406 (22001): Data too long for column 'txt' at row 1

Suggested fix:
Fix TEXT datatype and its variants maximum length are "bytes" instead of "characters".
[19 Aug 10:08] MySQL Verification Team
Thank you for your submission!
[19 Aug 11:32] Edward Gilmore
Posted by developer:
 
Documentation updated as requested.
Thank you for the bug report.