4056
4056
find_field_in_natural_join(THD *thd, TableList *table_ref, const char *name,
4057
4057
uint length __attribute__((unused)),
4058
Item **ref, bool register_tree_change,
4058
Item **ref __attribute__((unused)), bool register_tree_change __attribute__((unused)),
4059
4059
TableList **actual_table)
4061
4061
List_iterator_fast<Natural_join_column>
4085
if (nj_col->view_field)
4089
create_item() may, or may not create a new Item, depending on the
4090
column reference. See create_view_field() for details.
4092
item= nj_col->create_item(thd);
4094
*ref != NULL means that *ref contains the item that we need to
4095
replace. If the item was aliased by the user, set the alias to
4097
We need to set alias on both ref itself and on ref real item.
4099
if (*ref && !(*ref)->is_autogenerated_name)
4101
item->set_name((*ref)->name, (*ref)->name_length,
4102
system_charset_info);
4103
item->real_item()->set_name((*ref)->name, (*ref)->name_length,
4104
system_charset_info);
4109
assert(nj_col->table_field == NULL);
4110
if (nj_col->table_ref->schema_table_reformed)
4113
Translation table items are always Item_fields and fixed
4114
already('mysql_schema_table' function). So we can return
4115
->field. It is used only for 'show & where' commands.
4117
return(((Item_field*) (nj_col->view_field->item))->field);
4119
if (register_tree_change)
4120
thd->change_item_tree(ref, item);
4123
found_field= (Field*) view_ref_found;
4127
4085
/* This is a base table. */
4128
assert(nj_col->view_field == NULL);
4129
4086
assert(nj_col->table_ref->table == nj_col->table_field->table);
4130
4087
found_field= nj_col->table_field;
4131
4088
update_field_dependencies(thd, found_field, nj_col->table_ref->table);