pingcap / pingcap/tidb

Unexpected error on prepared statement "ERROR 1105 (HY000) at line 16: Data Too Long, field len 11, data len 29"

Open
#65,323 2 comments 0 reactions 0 assignees View on GitHub
contribution severity/moderate sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

Hi,

The following prepared update statement triggers an error "ERROR 1105 (HY000) at line 16: Data Too Long, field len 11, data len 29", but the equivalent normal update run successfully.

```
CREATE TABLE t0(c0 DECIMAL );
REPLACE INTO t0 VALUES (-1448876223);
UPDATE t0 SET c0=-1.184245842E9 WHERE CAST((CASE (- (0.6007861749962686)) WHEN -1247397029 THEN -2006287455 WHEN t0.c0 THEN t0.c0 ELSE t0.c0 END ) AS BINARY); -- no error
SET @a = -1.184245842E9;
SET @b = 0.6007861749962686;
SET @c = -1247397029;
SET @d = -2006287455;
SET @e = -1184245842;
SET @f = -1247397029;
SET @g = 0.31858846594926304;
PREPARE prepare_query FROM 'UPDATE t0 SET c0=? WHERE CAST((CASE (- (?)) WHEN ? THEN ? WHEN t0.c0 THEN (CASE t0.c0 WHEN t0.c0 THEN t0.c0 WHEN ? THEN ? ELSE ? END ) ELSE t0.c0 END ) AS BINARY)';
EXECUTE prepare_query USING @a,@b,@c,@d,@e,@f,@g;
-- ERROR 1105 (HY000) at line 16: Data Too Long, field len 11, data len 29
```

Not sure if it is a duplicate report with https://github.com/pingcap/tidb/issues/63775, but in this case the error is only triggered by the prepared update. Feel free to close the issue if it is a duplicate report.

### 2. What did you expect to see? (Required)

The prepared update should not trigger the error.

### 3. What did you see instead (Required)

The prepared update triggers an error "ERROR 1105 (HY000) at line 16: Data Too Long, field len 11, data len 29"

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

tidb_version()
Release Version: v9.0.0-beta.2.pre-551-g71caddf56d\nEdition: Community\nGit Commit Hash: 71caddf56d9c1887650568101590417558149e3f\nGit Branch: master\nUTC Build Time: 2025-10-11 06:46:47\nGoVersion: go1.23.12\nRace Enabled: false\nCheck Table Before Drop: false\nStore: unistore\nKernel Type: Classic

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.