Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.1.29, 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
-
None
-
Linux 4.16.0 Debian x86_64 GNU/Linux
Description
Test case:
create table t1 (id int primary key); |
create table t2 (id int primary key); |
insert t1 values (1),(2),(3); |
insert t2 values (1); |
create view t1_view as select a.id from t1 a join t2 order by a.id; |
|
MariaDB [tmp]> select count(*) from t1_view where id not in (select id from t1); |
+----------+ |
| count(*) | |
+----------+ |
| 3 |
|
+----------+ |
1 row in set (0.00 sec) |
|
MariaDB [tmp]> select count(*) from t1_view a where not exists (select id from t1 b where a.id=b.id); |
+----------+ |
| count(*) | |
+----------+ |
| 3 |
|
+----------+ |
1 row in set (0.00 sec) |
These results should be 0. The following runs correctly.
MariaDB [tmp]> select count(*) from t1_view where 0+id not in (select id from t1); |
+----------+ |
| count(*) | |
+----------+ |
| 0 |
|
+----------+ |
1 row in set (0.00 sec) |
|
MariaDB [tmp]> select count(*) from t1_view a where not exists (select id from t1 b where 0+a.id=b.id); |
+----------+ |
| count(*) | |
+----------+ |
| 0 |
|
+----------+ |
1 row in set (0.00 sec) |