summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorunknown <gluh@eagle.intranet.mysql.r18.ru>2006-06-29 16:52:46 +0500
committerunknown <gluh@eagle.intranet.mysql.r18.ru>2006-06-29 16:52:46 +0500
commita7f9f7ae743efca9b1f405773416d19f9ebaf3c2 (patch)
treef2ea28c11a3dc6f2075f8fd1aac5d21c2f9bbb47 /sql/sql_show.cc
parent728371c56e3e0a3f421425a9db9e5bab289670cc (diff)
downloadmariadb-git-a7f9f7ae743efca9b1f405773416d19f9ebaf3c2.tar.gz
Bug#19671 mysql_list_fields returns incorrect table name for VIEWs
After view onening real view db name and table name are placed into table_list->view_db & table_list->view_name. Item_field class does not handle these names properly during intialization of Send_field. The fix is to use new class 'Item_ident_for_show' which sets correct view db name and table name for Send_field. sql/item.cc: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs new Item_ident_for_show class which correctly sets view db and table names for Send_field. sql/item.h: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs new Item_ident_for_show class which correctly sets view db and table names for Send_field. sql/sql_show.cc: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs new Item_ident_for_show is used for views tests/mysql_client_test.c: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs test case
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 60d50c415d5..71a6b0acde9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -582,7 +582,14 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
{
if (!wild || !wild[0] ||
!wild_case_compare(system_charset_info, field->field_name,wild))
- field_list.push_back(new Item_field(field));
+ {
+ if (table_list->view)
+ field_list.push_back(new Item_ident_for_show(field,
+ table_list->view_db.str,
+ table_list->view_name.str));
+ else
+ field_list.push_back(new Item_field(field));
+ }
}
restore_record(table, s->default_values); // Get empty record
if (thd->protocol->send_fields(&field_list, Protocol::SEND_DEFAULTS |