Inconsistent behaviour of `\\` in normal query and 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,
The following test case contains two equivalent queries, one in normal select, and another in prepared statement.
However, the normal select returns `0` and the prepared statement returns `1`. I think the result of the normal select is correct as there is only `A` in t0.c0.
```
CREATE TABLE t0(c0 CHAR(100));
INSERT INTO t0 VALUES ('A');
SELECT (('\\6' IS TRUE) NOT IN (t0.c0, CAST(449007834 AS DECIMAL))) FROM t0;
SET @a = 449007834;
PREPARE prepare_query FROM "SELECT (('\\6' IS TRUE) NOT IN (t0.c0, CAST(? AS DECIMAL))) FROM t0";
EXECUTE prepare_query USING @a;
```
The same issue exists in MySQL and has been confirmed. https://bugs.mysql.com/bug.php?id=118982
### 2. 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.