Skip to content

planner: unexpected results after enabling fix-54337 #60556

@qw4990

Description

@qw4990

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (
  a int,
  b int,
  key ab(a, b)
);

insert into t values (100, 500);

set @@tidb_opt_fix_control = "54337:OFF";

select 1 from t where ((a>100) or (a=100 and b>0)) and ((a<100) or (a=100 and b<10));

set @@tidb_opt_fix_control = "54337:ON";

select 1 from t where ((a>100) or (a=100 and b>0)) and ((a<100) or (a=100 and b<10));

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

These 2 queries above should output the same results.

3. What did you see instead (Required)

The second query has a different output after enabling fix-54337:

mysql> set @@tidb_opt_fix_control = "54337:OFF";
Query OK, 0 rows affected (0.00 sec)

mysql> select 1 from t where ((a>100) or (a=100 and b>0)) and ((a<100) or (a=100 and b<10));
Empty set (0.00 sec)

mysql> set @@tidb_opt_fix_control = "54337:ON";
Query OK, 0 rows affected (0.00 sec)

mysql> select 1 from t where ((a>100) or (a=100 and b>0)) and ((a<100) or (a=100 and b<10));
+---+
| 1 |
+---+
| 1 |
| 1 |
+---+

4. What is your TiDB version? (Required)

Master Branch.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions