Details
-
Type:
Bug
-
Status: Closed
-
Resolution: Not a Bug
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:
Description
The query below returns no rows in maria-5.3 even though the subquery returns an empty result and therefore the ALL predicate should evaluate to TRUE. Not influenced by optimizer_switches. Not repeatable with maria-5.2, mysql-5.1. Also please check the = ALL form, as it appears to return an incorrect result as well .
test case:
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (0);
CREATE TABLE t2 ( b int, KEY (b) );
INSERT INTO t2 VALUES (0);
CREATE TABLE t3 ( c int) ;
INSERT INTO t3 VALUES (6);
CREATE TABLE t4 (d int) ;
SELECT * FROM t1
WHERE t1.a < ALL (
SELECT b FROM t2
WHERE EXISTS (
SELECT t3.c
FROM t4
LEFT JOIN t3 ON t3.c != 0
)
);
explain:
| 1 | PRIMARY | t1 | system | NULL | NULL | NULL | NULL | 1 | |
| 2 | SUBQUERY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Select tables optimized away |
| 3 | SUBQUERY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE noticed after reading const tables |
expected result:
------
| a |
------
| 0 |
------
optimizer switch:
index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on
bzr version-info
revision-id: <email address hidden>
date: 2011-07-20 11:56:28 +0400
build-date: 2011-07-20 15:58:31 +0300
revno: 3123
branch-nick: maria-5.3
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
Re: Wrong result with outer join + nested subquery with ALL
The bug is no longer reproducible with the following revision:
revision-id: igor@askmonty.org-20110721074337-qeijtrwilgdmtlsv
date: 2011-07-21 00:43:37 -0700
build-date: 2011-07-21 14:26:22 +0300
revno: 3128