1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN

fails after the first time
  
Two separate problems : 
  1. When flattening joins the linked list used for name resolution 
  (next_name_resolution_table) was not updated.
  Fixed by updating the pointers when extending the table list
  
  2. The items created by expanding a * (star) as a column reference
  were marked as fixed, but no cached table was assigned to them 
  (unlike what Item_field::fix_fields does).
  Fixed by assigning a cached table (so the re-preparation is done
  faster).
  
Note that the fix for #2 hides the fix for #1 in most cases
(except when a table reference cannot be cached).
This commit is contained in:
Georgi Kodinov
2008-10-17 17:55:06 +03:00
parent 4ab10baace
commit a0e3001cdb
4 changed files with 48 additions and 1 deletions

View File

@@ -8268,6 +8268,8 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
}
/* Flatten nested joins that can be flattened. */
TABLE_LIST *right_neighbor= NULL;
bool fix_name_res= FALSE;
li.rewind();
while ((table= li++))
{
@@ -8280,9 +8282,17 @@ simplify_joins(JOIN *join, List<TABLE_LIST> *join_list, COND *conds, bool top)
{
tbl->embedding= table->embedding;
tbl->join_list= table->join_list;
}
}
li.replace(nested_join->join_list);
/* Need to update the name resolution table chain when flattening joins */
fix_name_res= TRUE;
table= *li.ref();
}
if (fix_name_res)
table->next_name_resolution_table= right_neighbor ?
right_neighbor->first_leaf_for_name_resolution() :
NULL;
right_neighbor= table;
}
DBUG_RETURN(conds);
}