pingcap / pingcap/tidb

PREPARE INSERT with COMPRESS(?) returns ERROR 1406 when prepared plan cache is enabled

Open
#68,642 4 comments 0 reactions 0 assignees View on GitHub
affects-7.5 affects-8.1 affects-8.5 component/expression epic/plan-cache report/customer severity/major 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)

```
SET tidb_enable_prepared_plan_cache=1;

CREATE TABLE t (
id INT NOT NULL,
req_body MEDIUMBLOB DEFAULT NULL,
PRIMARY KEY (id)
);

PREPARE stmt FROM
'INSERT INTO t
(id, req_body)
VALUES (?, COMPRESS(?))';

SET @p1 = 1;
SET @p2 = '{"k":"v","payload":"MASKED_TEXT_ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789"}';

EXECUTE stmt USING @p1, @p2;
```

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

No error.

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

ERROR 1406 (22001): Data too long for column 'req_body' at row 1

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

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.