Incorrect type cast in prepared statement
- 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, in the following test case, the value of `t0.c0` is incorrectly cast to a string in the prepared statement. In the normal query, the query result is correct.
```
CREATE TABLE t0(c0 DOUBLE);
INSERT INTO t0(c0) VALUES (0);
SELECT ((INET6_ATON((t0.c0)))OR('a')) FROM t0; -- NULL
SET @a = 'a';
PREPARE prepare_query FROM 'SELECT ((INET6_ATON((t0.c0)))OR(?)) FROM t0';
EXECUTE prepare_query USING @a; -- Incorrect string value: '0' for function inet_aton6
```
### 2. What did you expect to see? (Required)
The prepared statement should not trigger an error.
### 3. What did you see instead (Required)
The prepared statement triggers an error.
### 4. What is your TiDB version? (Required)
Release Version: v9.0.0-beta.2.pre-196-g312226f869\nEdition: Community\nGit Commit Hash: 312226f869d56922135e1c177cac6c90319c3134\nGit Branch: HEAD\nUTC Build Time: 2025-09-21 08:27:14\nGoVersion: go1.23.11\nRace Enabled: false\nCheck Table Before Drop: false\nStore: unistore\nKernel Type: Classic
Contributor guide
Assessment
This issue has not been assessed yet.