From 71ecd3212bf489ac3d51957a4bd10e232a75d0ca Mon Sep 17 00:00:00 2001 From: David Hall Date: Mon, 23 May 2016 18:34:25 -0500 Subject: [PATCH] MCOL-23 working_tpch1_compareLogOnly/onClauseJoins/bug4031.sql: Create a better search for the correct TABLE_LIST* object. --- dbcon/mysql/ha_calpont_execplan.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index 5988a3a31..ff8cdea32 100755 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -1606,14 +1606,17 @@ SimpleColumn* buildSimpleColFromDerivedTable(gp_walk_info& gwi, Item_field* ifp) // outer join inner table filter can not be moved in // MariaDB 10.1: cached_table is never true for derived tables. // Find another way to determine outer_join - if (ifp->context && - ifp->context->table_list && - ifp->context->table_list->next_local && - !ifp->context->table_list->next_local->outer_join) -// if ((ifp->cached_table && !ifp->cached_table->outer_join)) + TABLE_LIST* tblList = ifp->context->table_list; + while (tblList) { - sc->derivedTable(derivedName); - sc->derivedRefCol(cols[j].get()); + if (strcasecmp(tblList->alias, ifp->table_name) == 0 && + !tblList->outer_join) + { + sc->derivedTable(derivedName); + sc->derivedRefCol(cols[j].get()); + break; + } + tblList = tblList->next_local; } cols[j]->incRefCount(); break;