diff options
author | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2006-01-24 16:48:19 +0400 |
---|---|---|
committer | unknown <gluh@eagle.intranet.mysql.r18.ru> | 2006-01-24 16:48:19 +0400 |
commit | 333b1f8594922647278808a4c114c16695551343 (patch) | |
tree | 847fce48cce8fd12c1deb74d0c82e424c197d071 /sql | |
parent | 74f670f291acd3ffaaca60a6659290c80f472c76 (diff) | |
download | mariadb-git-333b1f8594922647278808a4c114c16695551343.tar.gz |
Fix for bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema(2nd ver)
Fill schema tables with data before filesort if it's necessary
mysql-test/r/information_schema.result:
Fix for bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema(2nd ver)
test result
mysql-test/t/information_schema.test:
Fix for bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema(2nd ver)
test case
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_prepare.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 | ||||
-rw-r--r-- | sql/sql_show.cc | 12 | ||||
-rw-r--r-- | sql/table.h | 1 |
4 files changed, 20 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ffbbf0c6476..68f033f78fe 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2111,6 +2111,8 @@ void reinit_stmt_before_use(THD *thd, LEX *lex) were closed in the end of previous prepare or execute call. */ tables->table= 0; + /* Reset is_schema_table_processed value(needed for I_S tables */ + tables->is_schema_table_processed= FALSE; if (tables->prep_on_expr) { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 1037f490397..95da0e6263a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -11582,6 +11582,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, diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 17a8c846944..1f776d815df 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3845,7 +3845,16 @@ bool get_schema_tables_result(JOIN *join) TABLE_LIST *table_list= tab->table->pos_in_table_list; if (table_list->schema_table && thd->fill_derived_tables()) { - if (&lex->unit != lex->current_select->master_unit()) // is subselect + bool is_subselect= (&lex->unit != lex->current_select->master_unit()); + /* + The schema table is already processed and + the statement is not a subselect. + So we don't need to handle this table again. + */ + if (table_list->is_schema_table_processed && !is_subselect) + continue; + + if (is_subselect) // is subselect { table_list->table->file->extra(HA_EXTRA_RESET_STATE); table_list->table->file->delete_all_rows(); @@ -3858,6 +3867,7 @@ bool get_schema_tables_result(JOIN *join) if (table_list->schema_table->fill_table(thd, table_list, tab->select_cond)) result= 1; + table_list->is_schema_table_processed= TRUE; } } thd->no_warnings_for_error= 0; diff --git a/sql/table.h b/sql/table.h index ce0616a6833..947316e253f 100644 --- a/sql/table.h +++ b/sql/table.h @@ -515,6 +515,7 @@ typedef struct st_table_list st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */ ST_SCHEMA_TABLE *schema_table; /* Information_schema table */ st_select_lex *schema_select_lex; + bool is_schema_table_processed; /* True when the view field translation table is used to convert schema table fields for backwards compatibility with SHOW command. |