This is a refactoring worklog entry. Since WL#2984 was implemented, the existing implementation of Item_func_sp::sp_result_field became obsolete. It is slow, as a new field is created for every invocation, and more importantly, it is error prone (see BUG#23561 for details). Unfortunately, sp_result_field() can not be rewritten by using sp_head->sp_rcontext object, because sp_result_field() is called when sp_rcontext instance does not exist yet. There are the following ideas about possible solution: - use sp_result_field() by sp_rcontext somehow; - create a field for RETURNS-clause somewhere else and use it in sp_rcontext and in sp_result_field(); - create sp_rcontext instance on demand.