diff options
author | unknown <evgen@moonbone.local> | 2008-01-31 23:46:26 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2008-01-31 23:46:26 +0300 |
commit | 754c3f51ec6e0557b8c4ca2f141ee74075e11b48 (patch) | |
tree | 071239521c6241226d8fac388344637f6c9883a9 /sql | |
parent | e30a0dda8f322aa8714caf6d6de6d583e51809f1 (diff) | |
download | mariadb-git-754c3f51ec6e0557b8c4ca2f141ee74075e11b48.tar.gz |
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.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 639e069d24e..dbde4237511 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5515,6 +5515,8 @@ Item_func_sp::make_field(Send_field *tmp_field) DBUG_ENTER("Item_func_sp::make_field"); DBUG_ASSERT(sp_result_field); sp_result_field->make_field(tmp_field); + if (name) + tmp_field->col_name= name; DBUG_VOID_RETURN; } |