Incorrect result of ELT function when used in WHERE clause of 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, there are two equivalent queries, however, the normal SELECT returns 1 row, but the prepared SELECT returns an empty result.
```
CREATE TABLE t0(c0 BOOL);
INSERT INTO t0 VALUES (true);
SELECT t0.c0 FROM t0 WHERE ELT(0.6706395853005295, 758832383, '&', NULL); -- 1
SET @c = '&';
SET @d = NULL;
PREPARE prepare_query FROM 'SELECT t0.c0 FROM t0 WHERE ELT(0.6706395853005295, 758832383, ?, ?)';
EXECUTE prepare_query USING @c,@d; -- empty result
```
### 2. What did you expect to see? (Required)
The prepared SELECT returns 1 row.
### 3. What did you see instead (Required)
The prepared SELECT returns an empty result.
### 4. What is your TiDB version? (Required)
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
Assessment
This issue has not been assessed yet.