pingcap/tidb

Unexpected query result

sayJason opened this issue · 1 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

case 1

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT(20) UNSIGNED);
INSERT INTO t1 VALUES (18446744072965097661);
SELECT c1 FROM t1 WHERE ((CASE c1 WHEN 0.7 THEN 0 ELSE c1 END ))^c1; -- {18446744072965097661}

case 2

DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BIGINT(20) UNSIGNED);
INSERT INTO t1 VALUES (18446744072965097661);
SELECT c1 FROM t1 WHERE c1^c1; -- {}

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

case 1 should return the same result as case 2, since the CASE WHEN branch return c1.

3. What did you see instead (Required)

case 1 returns an incorrect result, while case 2 returns empty

4. What is your TiDB version? (Required)

Release Version: v7.0.0
Edition: Community
Git Commit Hash: 7376954
Git Branch: heads/refs/tags/v7.0.0
UTC Build Time: 2023-03-29 13:32:13
GoVersion: go1.20.2
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv

I tried the above two cases in MySQL8, which returns empty for these two cases.