Bug#30787: Stored function ignores user defined alias.
Simple subselects are pulled into upper selects. This operation substitutes the pulled subselect for the first item from the select list of the subselect. If an alias is defined for a subselect it is inherited by the replacement item. As this is done after fix_fields phase this alias isn't showed if the replacement item is a stored function. This happens because the Item_func_sp::make_field function makes send field from its result_field and ignores the defined alias. Now when an alias is defined the Item_func_sp::make_field function sets it for the returned field. mysql-test/t/sp.test: Added a test case for the bug#30787: Stored function ignores user defined alias. mysql-test/r/sp.result: Added a test case for the bug#30787: Stored function ignores user defined alias. sql/item_func.cc: Bug#30787: Stored function ignores user defined alias. Now when an alias is defined the Item_func_sp::make_field function sets it for the returned field.
Showing
Please register or sign in to comment