An expression has two different value in two queries
- 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)
Consider the following program:
```
USE test;
DROP DATABASE IF EXISTS database57;
CREATE DATABASE database57;
USE database57;
CREATE TABLE t0(c0 BOOL );
INSERT INTO t0(c0) VALUES (true), (0);
SELECT t0.c0 FROM t0; -- 1, 0
SELECT t0.c0 FROM t0 WHERE ((ATAN2(( (((t0.c0)NOT REGEXP(t0.c0)))|(t0.c0)), (- ('o'))))AND( t0.c0 IN ((0), (1)))); -- 1, 0
SELECT t0.c0 FROM t0 WHERE ((ATAN2(( (((t0.c0)NOT REGEXP(t0.c0)))|(t0.c0)), (- ('o'))))AND( t0.c0 IN (SELECT t0.c0 FROM t0))); -- 1
```
The third query is equivalent to the second one, but these two query has different results. As `t0.c0 IN (SELECT t0.c0 FROM t0)` always return `TRUE`, I tried this query `SELECT t0.c0 FROM t0 WHERE ((ATAN2(( (((t0.c0)NOT REGEXP(t0.c0)))|(t0.c0)), (- ('o'))))); ` and got the results `1` and `0`. I guess the third query generates an incorrect result.
### 4. What is your TiDB version? (Required)
```
Release Version: v7.1.0-alpha-194-g2002ca106\nEdition: Community\nGit Commit Hash: 2002ca106e99f56f6f06b04825c0b691267392df\nGit Branch: master\nUTC Build Time: 2023-04-13 07:33:01\nGoVersion: go1.20.3\nRace Enabled: false\nTiKV Min Version: 6.2.0-alpha\nCheck Table Before Drop: false\nStore: unistore
```
Contributor guide
Assessment
This issue has not been assessed yet.