mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Fix for BUG#20550: Stored function: wrong RETURN type metadata
when used in a VIEW. The problem was that wrong function (create_tmp_from_item()) was used to create a temporary field for Item_func_sp. The fix is to use create_tmp_from_field(). mysql-test/r/sp.result: Update result file. mysql-test/t/sp.test: Add a test case for BUG#20550. sql/item_func.h: Add a getter for Item_func_sp::sp_result_field. sql/sql_select.cc: Use create_tmp_from_field() to create a temporary field for Item_func_sp.
This commit is contained in:
@@ -9301,6 +9301,36 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
|
||||
}
|
||||
/* Fall through */
|
||||
case Item::FUNC_ITEM:
|
||||
if (((Item_func *) item)->functype() == Item_func::FUNC_SP)
|
||||
{
|
||||
Item_func_sp *item_func_sp= (Item_func_sp *) item;
|
||||
Field *sp_result_field= item_func_sp->get_sp_result_field();
|
||||
|
||||
if (make_copy_field)
|
||||
{
|
||||
DBUG_ASSERT(item_func_sp->result_field);
|
||||
*from_field= item_func_sp->result_field;
|
||||
}
|
||||
else
|
||||
{
|
||||
*((*copy_func)++)= item;
|
||||
}
|
||||
|
||||
Field *result_field=
|
||||
create_tmp_field_from_field(thd,
|
||||
sp_result_field,
|
||||
item_func_sp->name,
|
||||
table,
|
||||
NULL,
|
||||
convert_blob_length);
|
||||
|
||||
if (modify_item)
|
||||
item->set_result_field(result_field);
|
||||
|
||||
return result_field;
|
||||
}
|
||||
|
||||
/* Fall through */
|
||||
case Item::COND_ITEM:
|
||||
case Item::FIELD_AVG_ITEM:
|
||||
case Item::FIELD_STD_ITEM:
|
||||
|
||||
Reference in New Issue
Block a user