diff options
author | unknown <igor@rurik.mysql.com> | 2006-09-06 08:21:43 -0700 |
---|---|---|
committer | unknown <igor@rurik.mysql.com> | 2006-09-06 08:21:43 -0700 |
commit | 22c3e7b4e19be5b18026c905d886c4f7428c7dd6 (patch) | |
tree | ef9797f03cfe4a0614da783fc7572b33e0363eb3 /sql/sql_select.cc | |
parent | a1d03bd6321d4db38006140d3113f819bb34a83c (diff) | |
download | mariadb-git-22c3e7b4e19be5b18026c905d886c4f7428c7dd6.tar.gz |
Fixed bug #5500: EXPLAIN returned a wrong select_type for queries using views.
Select_type in the EXPLAIN output for the query SELECT * FROM t1 was
'SIMPLE', while for the query SELECT * FROM v1, where the view v1
was defined as SELECT * FROM t1, the EXPLAIN output contained 'PRIMARY'
for the select_type column.
mysql-test/r/group_by.result:
Adjusted results after the fix for bug #5500.
mysql-test/r/information_schema.result:
Adjusted results after the fix for bug #5500.
mysql-test/r/olap.result:
Adjusted results after the fix for bug #5500.
mysql-test/r/range.result:
Adjusted results after the fix for bug #5500.
mysql-test/r/view.result:
Added a test case for bug #5500.
Adjusted other results.
mysql-test/r/view_grant.result:
Adjusted results after the fix for bug #5500.
mysql-test/t/view.test:
Added a test case for bug #5500.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 47eb19364ee..1ff62a5f699 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -14221,9 +14221,12 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, item_list.push_back(new Item_string(table_name_buffer, len, cs)); } else - item_list.push_back(new Item_string(table->alias, - strlen(table->alias), + { + TABLE_LIST *tab=table->pos_in_table_list; + item_list.push_back(new Item_string(tab->alias, + strlen(tab->alias), cs)); + } /* type */ item_list.push_back(new Item_string(join_type_str[tab->type], strlen(join_type_str[tab->type]), @@ -14410,8 +14413,8 @@ bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) // drop UNCACHEABLE_EXPLAIN, because it is for internal usage only uint8 uncacheable= (sl->uncacheable & ~UNCACHEABLE_EXPLAIN); sl->type= (((&thd->lex->select_lex)==sl)? - ((thd->lex->all_selects_list != sl) ? - primary_key_name : "SIMPLE"): + (sl->first_inner_unit() || sl->next_select() ? + "PRIMARY" : "SIMPLE"): ((sl == first)? ((sl->linkage == DERIVED_TABLE_TYPE) ? "DERIVED": |