pingcap / pingcap/tidb

Fail to execute SELECT in TiDB but succeed in MySQL

Open
#61,948 2 comments 0 reactions 0 assignees View on GitHub
severity/minor 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
CREATE TABLE t0(c0 INTEGER UNSIGNED ZEROFILL PRIMARY KEY );
CREATE TABLE t1 LIKE t0;
CREATE TABLE t48 LIKE t1;

REPLACE INTO t1(c0) VALUES (2021628517);

CREATE TABLE tt0(c0 int(10) unsigned zerofill);
INSERT INTO tt0 SELECT * FROM t0;
CREATE TABLE tt1(c0 int(10) unsigned zerofill);
INSERT INTO tt1 SELECT * FROM t1;
CREATE TABLE tt48(c0 int(10) unsigned zerofill);
INSERT INTO tt48 SELECT * FROM t48;

SELECT tt1.c0, tt48.c0 FROM tt48, tt1 WHERE INSERT(1611606206, '', CAST((BINARY (tt1.c0)) AS DATE), 1246216207);
```

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

SELECT executed successfully

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

```sql
ERROR 1105 (HY000): expected integer
```

### 4. What is your TiDB version? (Required)
·``sql
Release Version: v9.0.0-beta.1.pre-640-g24903d6b24
Edition: Community
Git Commit Hash: 24903d6b24674b9a43625ac2d05bf1b033b04407
Git Branch: master
UTC Build Time: 2025-04-27 01:17:32
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.