diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc index d053e9b5670..f6a27b1b1b3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5426,6 +5426,8 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref, Item_direct_view_ref(thd, &view->view->select_lex.context, field_ref, view->alias, name, view)); + if (!item) + return NULL; /* Force creation of nullable item for the result tmp table for outer joined views/derived tables. @@ -7356,7 +7358,15 @@ int TABLE_LIST::fetch_number_of_rows() { int error= 0; if (jtbm_subselect) + { + if (jtbm_subselect->is_jtbm_merged) + { + table->file->stats.records= jtbm_subselect->jtbm_record_count; + set_if_bigger(table->file->stats.records, 2); + table->used_stat_records= table->file->stats.records; + } return 0; + } if (is_materialized_derived() && !fill_me) { |