summaryrefslogtreecommitdiff
path: root/sql/table.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2015-04-14 23:18:54 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2015-04-23 15:56:10 +0200
commit20109712aeb3d23e5e975780897ad236cbcd2ddc (patch)
tree1d6e7509cce9617bb40c8dcffc34b6cc810e1eb3 /sql/table.cc
parent8cbaafd22b145512cc91f7b512290320849e77bd (diff)
downloadmariadb-git-20109712aeb3d23e5e975780897ad236cbcd2ddc.tar.gz
MDEV-6892: WHERE does not apply
Taking into account implicit dependence of constant view field from nullable table of left join added. Fixed finding real table to check if it turned to NULL (materialized view & derived taken into account) Removed incorrect uninitialization.
Diffstat (limited to 'sql/table.cc')
-rw-r--r--sql/table.cc42
1 files changed, 20 insertions, 22 deletions
diff --git a/sql/table.cc b/sql/table.cc
index 7df2ae641ca..e4dee77171d 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5034,7 +5034,8 @@ TABLE *TABLE_LIST::get_real_join_table()
TABLE_LIST *tbl= this;
while (tbl->table == NULL || tbl->table->reginfo.join_tab == NULL)
{
- if (tbl->view == NULL && tbl->derived == NULL)
+ if ((tbl->view == NULL && tbl->derived == NULL) ||
+ tbl->is_materialized_derived())
break;
/* we do not support merging of union yet */
DBUG_ASSERT(tbl->view == NULL ||
@@ -5043,28 +5044,25 @@ TABLE *TABLE_LIST::get_real_join_table()
tbl->derived->first_select()->next_select() == NULL);
{
- List_iterator_fast<TABLE_LIST> ti;
+ List_iterator_fast<TABLE_LIST>
+ ti(tbl->view != NULL ?
+ tbl->view->select_lex.top_join_list :
+ tbl->derived->first_select()->top_join_list);
+ for (;;)
{
- List_iterator_fast<TABLE_LIST>
- ti(tbl->view != NULL ?
- tbl->view->select_lex.top_join_list :
- tbl->derived->first_select()->top_join_list);
- for (;;)
- {
- tbl= NULL;
- /*
- Find left table in outer join on this level
- (the list is reverted).
- */
- for (TABLE_LIST *t= ti++; t; t= ti++)
- tbl= t;
- if (!tbl)
- return NULL; // view/derived with no tables
- if (!tbl->nested_join)
- break;
- /* go deeper if we've found nested join */
- ti= tbl->nested_join->join_list;
- }
+ tbl= NULL;
+ /*
+ Find left table in outer join on this level
+ (the list is reverted).
+ */
+ for (TABLE_LIST *t= ti++; t; t= ti++)
+ tbl= t;
+ if (!tbl)
+ return NULL; // view/derived with no tables
+ if (!tbl->nested_join)
+ break;
+ /* go deeper if we've found nested join */
+ ti= tbl->nested_join->join_list;
}
}
}