From 645191aa1338caa397124e5c02002d93a07a628b Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Thu, 20 Jun 2019 18:50:20 -0700 Subject: MDEV-19778 Wrong Result on Left Outer Join with Subquery right on true and WHERE filter afterwards This patch complements the patch fixing the bug MDEV-6892. The latter properly handled queries that used mergeable views returning constant columns as inner tables of outer joins and whose where clause contained predicates referring to these columns if the predicates of happened not to be equality predicates. Otherwise the server still could return wrong result sets for such queries. Besides the fix for MDEV-6892 prevented some possible conversions of outer joins to inner joins for such queries. This patch corrected the function check_simple_equality() to handle properly conjunctive equalities of the where clause that refer to the constant columns of mergeable views used as inner tables of an outer join. The patch also changed the code of Item_direct_view_ref::not_null_tables(). This change allowed to take into account predicates containing references to constant columns of mergeable views when converting outer joins into inner joins. --- sql/item_func.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/item_func.cc') diff --git a/sql/item_func.cc b/sql/item_func.cc index 22d7e8c7bb6..dad4b89b3bc 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -226,6 +226,7 @@ Item_func::fix_fields(THD *thd, Item **ref) with_field= with_field || item->with_field; used_tables_cache|= item->used_tables(); const_item_cache&= item->const_item(); + not_null_tables_cache|= item->not_null_tables(); with_subselect|= item->has_subquery(); } } -- cgit v1.2.1