pingcap / pingcap/tidb

Failed to check NULL parameters in TRUNCATE operation

Open
#64,095 1 comment 0 reactions 0 assignees View on GitHub
contribution sig/execution 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)

```sql
DROP TABLE t1;
CREATE TABLE t1 (c1 MEDIUMINT UNSIGNED PRIMARY KEY);
INSERT INTO t1 VALUES (0);
SELECT TRUNCATE(c1 = -1, -1.0 << NULL) FROM t1; -- acutal: {0}, expected: {NULL}
```
### 2. What did you expect to see? (Required)
NULL should be returned.
### 3. What did you see instead (Required)
0 was returned.
### 4. What is your TiDB version? (Required)

Release Version: v8.5.3
Edition: Community
Git Commit Hash: dc2548aac79a712265e831cff2a3a896bc0a5a38
Git Branch: HEAD
UTC Build Time: 2025-07-31 13:54:43
GoVersion: go1.23.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv

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.