mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fix for BUG#13410 - qualified reference to a view column in the HAVING clause cannot be resolved.
The problem was then when a column reference was resolved to a view column, the new Item created for this column contained the name of the view, and not the view alias.
This commit is contained in:
18
sql/table.cc
18
sql/table.cc
@ -2424,22 +2424,6 @@ Field *Natural_join_column::field()
|
||||
const char *Natural_join_column::table_name()
|
||||
{
|
||||
return table_ref->alias;
|
||||
/*
|
||||
TODO:
|
||||
I think that it is sufficient to return just
|
||||
table->alias, which is correctly set to either
|
||||
the view name, the table name, or the alias to
|
||||
the table reference (view or stored table).
|
||||
*/
|
||||
#ifdef NOT_YET
|
||||
if (view_field)
|
||||
return table_ref->view_name.str;
|
||||
|
||||
DBUG_ASSERT(!strcmp(table_ref->table_name,
|
||||
table_ref->table->s->table_name));
|
||||
return table_ref->table_name;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2575,7 +2559,7 @@ Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref,
|
||||
DBUG_RETURN(field);
|
||||
}
|
||||
Item *item= new Item_direct_view_ref(&view->view->select_lex.context,
|
||||
field_ref, view->view_name.str,
|
||||
field_ref, view->alias,
|
||||
name);
|
||||
DBUG_RETURN(item);
|
||||
}
|
||||
|
Reference in New Issue
Block a user