pingcap / pingcap/tidb

Logical AND evaluates incorrectly when combined with an IS FALSE condition

Open
#64,414 0 comments 0 reactions 0 assignees View on GitHub
contribution sig/planner type/bug
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)

CREATE TABLE t547 (c1 CHARACTER, c2 VARBINARY (3));
INSERT t547 () VALUES ('1','K');
SELECT * FROM t547 WHERE ((((LOCATE('[B@774c06fd', t547.c2, '2005-04-01') - 1)) AND (((BINARY CAST(t547.c1 AS SIGNED)) LIKE 1) IS FALSE)));
-- empty set
SELECT SUM(count) FROM (SELECT (((((LOCATE('[B@774c06fd', t547.c2, '2005-04-01') - 1)) AND (((BINARY CAST(t547.c1 AS SIGNED)) LIKE 1) IS FALSE)))) IS TRUE AS count FROM t547) AS ta_norec;
-- 1
### 2. What did you expect to see? (Required)
The first query should return an empty set, and the second query should return 0.
### 3. What did you see instead (Required)
The first query should return an empty set, and the second query should return 1.
### 4. What is your TiDB version? (Required)

Release Version: v8.5.0-20251010-ec6b882
Edition: Community
Git Commit Hash: https://github.com/pingcap/tidb/commit/ec6b882d188f77c199907ba26843a872b8c5fd6d
Git Branch: heads/refs/tags/v8.5.0-20251010-ec6b882
UTC Build Time: 2025-10-10 10:21:51
GoVersion: go1.23.3
Race Enabled: false
Check Table Before Drop: false
Store: unistore

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.