-
-
Notifications
You must be signed in to change notification settings - Fork 586
Closed
Labels
analyzerbugSomething isn't workingSomething isn't workingcorrectnessWe don't return the same result as MySQLWe don't return the same result as MySQLsqlIssue with SQLIssue with SQL
Description
Setup:
create table t1 (i int);
create table t2 (j int);
insert into t1 values (1), (null);
insert into t2 values (2), (null);Dolt:
tmp> select * from t1 where i not in (select j from t2);
+------+
| i |
+------+
| 1 |
| NULL |
+------+
2 rows in set (0.00 sec)MySQL:
mysql> select * from t1 where i not in (select j from t2);
Empty set (0.0006 sec)Plan:
tmp> explain select * from t1 where i not in (select j from t2);
+-----------------------------+
| plan |
+-----------------------------+
| AntiJoin |
| ├─ (t1.i = scalarSubq0.j) |
| ├─ Table |
| │ └─ name: t1 |
| └─ TableAlias(scalarSubq0) |
| └─ Table |
| ├─ name: t2 |
| └─ columns: [j] |
+-----------------------------+
8 rows in set (0.00 sec)It seems like we should either avoid using the optimization in this case or fix the join conditions.
Metadata
Metadata
Assignees
Labels
analyzerbugSomething isn't workingSomething isn't workingcorrectnessWe don't return the same result as MySQLWe don't return the same result as MySQLsqlIssue with SQLIssue with SQL