MDEV-5369: Wrong result (0 instead of NULL) on 2nd execution of PS with LEFT JOIN, TEMPTABLE view

Set of JOIN_TYPE_OUTER made only once to avoid interference with optimization joins which made only once per query.
This commit is contained in:
unknown 2014-01-28 23:23:14 +02:00
commit 08293a35e6
3 changed files with 45 additions and 1 deletions

View file

@ -627,7 +627,7 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
if ((res= sl->handle_derived(lex, DT_PREPARE)))
goto exit;
if (derived->outer_join)
if (derived->outer_join && sl->first_cond_optimization)
{
/* Mark that table is part of OUTER JOIN and fields may be NULL */
for (TABLE_LIST *cursor= (TABLE_LIST*) sl->table_list.first;