From ec7da1561e028aac40dee69433113978c982ce84 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 25 Sep 2013 15:30:13 +0300 Subject: MDEV-5039: incorrect Item_func_regex::update_used_tables() Other fix of maybe_null problem and revert of revno: 3608 "MDEV-3873 & MDEV-3876 & MDEV-3912 : Wrong result (extra rows) with ALL subquery from a MERGE view." --- sql/sql_derived.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sql/sql_derived.cc') diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index afc2dea359a..a8bfc8a11a7 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -622,6 +622,15 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived) sl->context.outer_context= 0; // Prepare underlying views/DT first. sl->handle_derived(lex, DT_PREPARE); + + if (derived->outer_join) + { + /* Mark that table is part of OUTER JOIN and fields may be NULL */ + for (TABLE_LIST *cursor= (TABLE_LIST*) sl->table_list.first; + cursor; + cursor= cursor->next_local) + cursor->outer_join|= JOIN_TYPE_OUTER; + } } unit->derived= derived; @@ -716,6 +725,10 @@ exit: /* Add new temporary table to list of open derived tables */ table->next= thd->derived_tables; thd->derived_tables= table; + + /* If table is used by a left join, mark that any column may be null */ + if (derived->outer_join) + table->maybe_null= 1; } if (arena) thd->restore_active_arena(arena, &backup); -- cgit v1.2.1