diff options
-rw-r--r-- | mysql-test/r/named_pipe.result | 56 | ||||
-rw-r--r-- | mysql-test/r/shm.result | 56 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 7 |
3 files changed, 61 insertions, 58 deletions
diff --git a/mysql-test/r/named_pipe.result b/mysql-test/r/named_pipe.result index 32e96fa27b7..57b38a97549 100644 --- a/mysql-test/r/named_pipe.result +++ b/mysql-test/r/named_pipe.result @@ -183,37 +183,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1389,15 +1389,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1413,15 +1413,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 diff --git a/mysql-test/r/shm.result b/mysql-test/r/shm.result index c504fe222ef..a92efca148b 100644 --- a/mysql-test/r/shm.result +++ b/mysql-test/r/shm.result @@ -183,37 +183,37 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range fld1 fld1 4 NULL 4 Using where; Using index select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%'; fld1 fld3 -218401 faithful +012001 flanking +013602 foldout +013606 fingerings 018007 fanatic -228311 fated 018017 featherweight -218022 feed -088303 feminine -058004 Fenton -038017 fetched 018054 fetters -208101 fiftieth -238007 filial -013606 fingerings -218008 finishers -038205 firearm -188505 fitting -202301 Fitzpatrick -238008 fixedly -012001 flanking 018103 flint 018104 flopping +036002 funereal +038017 fetched +038205 firearm +058004 Fenton +088303 feminine +186002 freakish 188007 flurried -013602 foldout +188505 fitting +198006 furthermore +202301 Fitzpatrick +208101 fiftieth +208113 freest +218008 finishers +218022 feed +218401 faithful 226205 foothill -232102 forgivably +226209 furnishings 228306 forthcoming -186002 freakish -208113 freest +228311 fated 231315 freezes -036002 funereal -226209 furnishings -198006 furthermore +232102 forgivably +238007 filial +238008 fixedly select fld3 from t2 where fld3 like "L%" and fld3 = "ok"; fld3 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly"); @@ -1389,15 +1389,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 and companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr > 0 or t2.companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 @@ -1413,15 +1413,15 @@ id select_type table type possible_keys key key_len ref rows Extra explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr is null; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where companynr > 0 or companynr < 0 or companynr > 0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL PRIMARY NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where explain select companynr,companyname from t4 left join t2 using (companynr) where ifnull(companynr,1)>0; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t4 ALL NULL NULL NULL NULL 12 Using where -1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 +1 SIMPLE t2 ALL NULL NULL NULL NULL 1199 Using where select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1; companynr companynr 37 36 diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index d87db138a14..0b89adb75e8 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -5894,12 +5894,15 @@ Item_field* Item_equal::get_first(Item_field *field) It's a field from an materialized semi-join. We can substitute it only for a field from the same semi-join. */ - JOIN_TAB *first; + JOIN_TAB *first= field_tab; JOIN *join= field_tab->join; int tab_idx= field_tab - field_tab->join->join_tab; + DBUG_ASSERT(join->join_tab[tab_idx].table->map & + emb_nest->sj_inner_tables); + /* Find the first table of this semi-join nest */ - for (int i= tab_idx; i >= (int)join->const_tables; i--) + for (int i= tab_idx-1; i >= (int)join->const_tables; i--) { if (join->join_tab[i].table->map & emb_nest->sj_inner_tables) first= join->join_tab + i; |