pingcap / pingcap/tidb

MEDIUMTEXT field exceed max length stored as null silently without error!

Open
#32,869 1 comment 0 reactions 1 assignee Claimed by @Jasonysli View on GitHub
severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report
MEDIUMTEXT field exceed max length stored as null silently without error!

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
DROP TABLE IF EXISTS t2;
CREATE TABLE t2(c1 MEDIUMTEXT);
INSERT INTO t2 (c1) VALUES(REPEAT(X'C385', 8777215));

### 2. What did you expect to see? (Required)
INSERT INTO t2 (c1) VALUES(REPEAT(X'C385', 8777215));
ERROR 1406 (22001): Data too long for column 'c1' at row 1

### 3. What did you see instead (Required)
DROP TABLE IF EXISTS t2;--Query OK, 0 rows affected (0.01 sec)
CREATE TABLE t2(c1 MEDIUMTEXT);--Query OK, 0 rows affected (0.00 sec)
INSERT INTO t2 (c1) VALUES(REPEAT(X'C385', 8777215));--Query OK, 1 row affected (0.00 sec)

But the stored value is:
select * from t2;
+------+
| c1 |
+------+
| NULL |
+------+
1 row in set (0.01 sec)

### 4. What is your TiDB version? (Required)

5.7.25-TiDB-v5.5.0-alpha-348-g3e1cd2733-dirty

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.