Skip to content

Invalid query result on a cached table #52755

@sayJason

Description

@sayJason

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE t1 (c1 int, c2 int, UNIQUE i1 (c1, c2));
INSERT INTO t1 VALUES (7, null),(5,1);
SELECT c1 FROM t1 WHERE ('m' = ALL (SELECT /*+ IGNORE_INDEX(t1, i1) */ c2 FROM t1)) IS NOT UNKNOWN; -- {}
SELECT c1 FROM t1 WHERE ('m' = ALL (SELECT /*+ USE_INDEX(t1, i1) */ c2 FROM t1)) IS NOT UNKNOWN; -- {5,7}

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

The first query should also return {5,7}.

3. What did you see instead (Required)

The first query returns an empty result.

4. What is your TiDB version? (Required)

Release Version: v8.0.0
Edition: Community
Git Commit Hash: 8ba1fa4
Git Branch: HEAD
UTC Build Time: 2024-03-28 14:22:15
GoVersion: go1.21.4
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Metadata

Metadata

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions