diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 47f970a4f82..47aa53d25e2 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -9117,7 +9117,7 @@ TABLE *create_virtual_tmp_table(THD *thd, List<create_field> &field_list) field++; } - *field= NULL; /* mark the end of the list */ + *field= NULL; /* mark the end of the list */ share->blob_field[blob_count]= 0; /* mark the end of the list */ share->blob_fields= blob_count; @@ -11659,6 +11659,12 @@ create_sort_index(THD *thd, JOIN *join, ORDER *order, goto err; } } + + /* Fill schema tables with data before filesort if it's necessary */ + if ((join->select_lex->options & OPTION_SCHEMA_TABLE) && + get_schema_tables_result(join)) + goto err; + if (table->s->tmp_table) table->file->info(HA_STATUS_VARIABLE); // Get record count table->sort.found_records=filesort(thd, table,sortorder, length, |