summaryrefslogtreecommitdiff
path: root/sql/item_row.cc
diff options
context:
space:
mode:
authorSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-19 10:21:37 +0400
committerSergey Glukhov <Sergey.Glukhov@sun.com>2010-03-19 10:21:37 +0400
commitd1c2e8508fcc795eb5aeafe1af492929ec13ee97 (patch)
treebac600074d72d2769dd262757434eebbacb45fcf /sql/item_row.cc
parentcaa1ccb0c324bca664112a5562f174f603e0a0b7 (diff)
downloadmariadb-git-d1c2e8508fcc795eb5aeafe1af492929ec13ee97.tar.gz
Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison
Optimizer erroneously translated LEFT JOIN into INNER JOIN. It leads to cutting rows with NULL right side. It happens because Item_row uses not_null_tables() method form the base(Item) class and does not calculate 'null tables' properly. The fix is adding calculation of 'not null tables' to Item_row. mysql-test/r/join_outer.result: test result mysql-test/t/join_outer.test: test case sql/item_row.cc: adding calculation of 'not null tables' to Item_row. sql/item_row.h: adding calculation of 'not null tables' to Item_row.
Diffstat (limited to 'sql/item_row.cc')
-rw-r--r--sql/item_row.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_row.cc b/sql/item_row.cc
index 29b37eb2bc0..7535c1fa80b 100644
--- a/sql/item_row.cc
+++ b/sql/item_row.cc
@@ -30,7 +30,8 @@
*/
Item_row::Item_row(List<Item> &arg):
- Item(), used_tables_cache(0), const_item_cache(1), with_null(0)
+ Item(), used_tables_cache(0), not_null_tables_cache(0),
+ const_item_cache(1), with_null(0)
{
//TODO: think placing 2-3 component items in item (as it done for function)
@@ -71,6 +72,7 @@ bool Item_row::fix_fields(THD *thd, Item **ref)
Item *item= *arg;
used_tables_cache |= item->used_tables();
const_item_cache&= item->const_item() && !with_null;
+ not_null_tables_cache|= item->not_null_tables();
/*
Some subqueries transformations aren't done in the view_prepare_mode thus
is_null() will fail. So we skip is_null() calculation for CREATE VIEW as