mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed LP bug #806057.
A table expression with a natural join or a USING clause is transformed into an equivalent expression with equi-join ON conditions. If a reference to a virtual column happened to occur only in these generated equi-join conditions then it was not erroneously marked in the TABLE::vcol_set bitmap. This could lead to wrong results for queries containing natural join expressions or USING clauses.
This commit is contained in:
@ -7151,11 +7151,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);
|
||||
|
Reference in New Issue
Block a user