Item_singlerow_subselect will be rewritten only
if it contains no FROM clause, and it is not
part of UNION, and it is a scalar subquery. For
now, there will be no conversion of subqueries with field or
reference on top of item list (on the one hand, we can't change
the name of such items, but on the other hand, we should assign to
it the name of the whole subquery which will be reduced).
The following will not be reduced:
SELECT a; SELECT 1 UNION SELECT 2; SELECT 1 FROM t1;
The following select will be reduced:
SELECT 1; SELECT a+2;
Such a subquery will be completely replaced by its expression from
item list and its SELECT_LEX and
SELECT_LEX_UNIT will be removed from
SELECT_LEX's tree.
But every Item_field and
Item_ref of that expression will be marked for
processing by a special fix_fields() procedure.
The fix_fields() procedures for such
Items will be performed in the same way as for
items of an inner subquery. Also, if this expression is
Item_fields or Item_ref,
then the name of this new item will be the same as the name of
this item (but not (SELECT ...)). This is done
to prevent broken references on such items from more inner
subqueries.
