summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2014-10-17 12:59:28 -0700
committerIgor Babaev <igor@askmonty.org>2014-10-17 12:59:28 -0700
commita4d1783aaeea6a3e4a46084fde161ff7152fd2da (patch)
tree53114e3a6cd5a3361cc1a092006e40c1153e004c /sql
parent3c4bb0e8720b84a14fe4822d1986d01290b9ab44 (diff)
downloadmariadb-git-a4d1783aaeea6a3e4a46084fde161ff7152fd2da.tar.gz
Fixed bug mdev-6874.
The method subselect_union_engine::no_rows() must take into account the fact that now unit->fake_select_lex is NULL for for select_union_direct objects.
Diffstat (limited to 'sql')
-rw-r--r--sql/item_subselect.cc4
-rw-r--r--sql/sql_class.h5
-rw-r--r--sql/sql_union.cc1
3 files changed, 8 insertions, 2 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index affea8d28f8..ef3ebae0521 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -3395,7 +3395,9 @@ bool subselect_union_engine::is_executed() const
bool subselect_union_engine::no_rows()
{
/* Check if we got any rows when reading UNION result from temp. table: */
- return MY_TEST(!unit->fake_select_lex->join->send_records);
+ return MY_TEST(!(unit->fake_select_lex ?
+ unit->fake_select_lex->join->send_records :
+ ((select_union_direct *) result)->send_records));
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9fe524b5fe6..c27900375e7 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -4397,11 +4397,13 @@ private:
ha_rows limit;
public:
+ /* Number of rows in the union */
+ ha_rows send_records;
select_union_direct(select_result *result, SELECT_LEX *last_select_lex)
:result(result), last_select_lex(last_select_lex),
done_send_result_set_metadata(false), done_initialize_tables(false),
limit_found_rows(0)
- {}
+ { send_records= 0; }
bool change_result(select_result *new_result);
uint field_count(List<Item> &fields) const
{
@@ -4432,6 +4434,7 @@ public:
and for the results of subquery engines
(select_<something>_subselect).
*/
+ send_records= 0;
DBUG_ASSERT(false); /* purecov: inspected */
}
void set_thd(THD *thd_arg)
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index cfc34b0f90a..9b8188b568d 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -246,6 +246,7 @@ int select_union_direct::send_data(List<Item> &items)
return false;
}
+ send_records++;
fill_record(thd, table, table->field, items, true, false);
if (thd->is_error())
return true; /* purecov: inspected */