mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
5.3.4 merge
This commit is contained in:
@ -1923,14 +1923,15 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
|
||||
t_name= table->table_name;
|
||||
t_alias= table->alias;
|
||||
|
||||
retry:
|
||||
DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
|
||||
for (;;)
|
||||
for (TABLE_LIST *tl= table_list;;)
|
||||
{
|
||||
/*
|
||||
Table is unique if it is present only once in the global list
|
||||
of tables and once in the list of table locks.
|
||||
*/
|
||||
if (! (res= find_table_in_global_list(table_list, d_name, t_name)))
|
||||
if (! (res= find_table_in_global_list(tl, d_name, t_name)))
|
||||
break;
|
||||
|
||||
/* Skip if same underlying table. */
|
||||
@ -1961,10 +1962,23 @@ TABLE_LIST* find_dup_table(THD *thd, TABLE_LIST *table, TABLE_LIST *table_list,
|
||||
(exclude_from_table_unique_test) or prelocking placeholder.
|
||||
*/
|
||||
next:
|
||||
table_list= res->next_global;
|
||||
tl= res->next_global;
|
||||
DBUG_PRINT("info",
|
||||
("found same copy of table or table which we should skip"));
|
||||
}
|
||||
if (res && res->belong_to_derived)
|
||||
{
|
||||
/* Try to fix */
|
||||
TABLE_LIST *derived= res->belong_to_derived;
|
||||
if (derived->is_merged_derived())
|
||||
{
|
||||
DBUG_PRINT("info",
|
||||
("convert merged to materialization to resolve the conflict"));
|
||||
derived->change_refs_to_fields();
|
||||
derived->set_materialized_derived();
|
||||
}
|
||||
goto retry;
|
||||
}
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
@ -7363,11 +7377,16 @@ mark_common_columns(THD *thd, TABLE_LIST *table_ref_1, TABLE_LIST *table_ref_2,
|
||||
if (!(eq_cond= new Item_func_eq(item_ident_1, item_ident_2)))
|
||||
goto err; /* Out of memory. */
|
||||
|
||||
if (field_1 && field_1->vcol_info)
|
||||
field_1->table->mark_virtual_col(field_1);
|
||||
if (field_2 && field_2->vcol_info)
|
||||
field_2->table->mark_virtual_col(field_2);
|
||||
|
||||
/*
|
||||
Add the new equi-join condition to the ON clause. Notice that
|
||||
fix_fields() is applied to all ON conditions in setup_conds()
|
||||
so we don't do it here.
|
||||
*/
|
||||
*/
|
||||
add_join_on((table_ref_1->outer_join & JOIN_TYPE_RIGHT ?
|
||||
table_ref_1 : table_ref_2),
|
||||
eq_cond);
|
||||
@ -8085,7 +8104,8 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
|
||||
while ((table_list= ti++))
|
||||
{
|
||||
TABLE *table= table_list->table;
|
||||
table->pos_in_table_list= table_list;
|
||||
if (table)
|
||||
table->pos_in_table_list= table_list;
|
||||
if (first_select_table &&
|
||||
table_list->top_table() == first_select_table)
|
||||
{
|
||||
@ -8098,7 +8118,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
|
||||
{
|
||||
table_list->jtbm_table_no= tablenr;
|
||||
}
|
||||
else
|
||||
else if (table)
|
||||
{
|
||||
table->pos_in_table_list= table_list;
|
||||
setup_table_map(table, table_list, tablenr);
|
||||
|
Reference in New Issue
Block a user