mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
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.
This commit is contained in:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user