summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-01-14 16:03:35 +0100
committerSergei Golubchik <serg@mariadb.org>2018-01-17 00:44:16 +0100
commit715a507e3368451b824f211dea34a55c5d4dac1d (patch)
tree59e95139b9c0eadb36eb8f6e33b6209f01d0ccd5 /sql/sql_union.cc
parent1ea2b2956b8204e58a515f8828f8749f321a0692 (diff)
downloadmariadb-git-715a507e3368451b824f211dea34a55c5d4dac1d.tar.gz
MDEV-14786 Server crashes in Item_cond::transform on 2nd execution of SP querying from a view
instead of skipping invalid items in setup_conds(), don't pass them into a JOIN at all (test case in versioning.select2)
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 82745b61929..dda57cc5b4d 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -645,6 +645,7 @@ bool st_select_lex_unit::prepare_join(THD *thd_arg, SELECT_LEX *sl,
bool is_union_select)
{
DBUG_ENTER("st_select_lex_unit::prepare_join");
+ TABLE_LIST *derived= sl->master_unit()->derived;
bool can_skip_order_by;
sl->options|= SELECT_NO_UNLOCK;
JOIN *join= new JOIN(thd_arg, sl->item_list,
@@ -660,7 +661,7 @@ bool st_select_lex_unit::prepare_join(THD *thd_arg, SELECT_LEX *sl,
saved_error= join->prepare(sl->table_list.first,
sl->with_wild,
- sl->where,
+ (derived && derived->merged ? NULL : sl->where),
(can_skip_order_by ? 0 :
sl->order_list.elements) +
sl->group_list.elements,