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.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/item.h') diff --git a/sql/item.h b/sql/item.h index f6c3c20516b..6dc99970914 100644 --- a/sql/item.h +++ b/sql/item.h @@ -3382,6 +3382,7 @@ public: void update_used_tables(); table_map not_null_tables() const; bool const_item() const { return used_tables() == 0; } + TABLE *get_null_ref_table() const { return null_ref_table; } bool walk(Item_processor processor, bool walk_subquery, uchar *arg) { return (*ref)->walk(processor, walk_subquery, arg) || -- cgit v1.2.1