maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #10287
Re: [Commits] eb8d31d: MDEV-10232: Scalar result of subquery changes after adding an outer select stmt
Hi Varun,
Please make the fix for MDEV-10232 to be one changeset. Ok to push that
changeset.
On Sun, Jan 15, 2017 at 07:44:35PM +0530, Varun wrote:
> revision-id: eb8d31d96f32da53d34d4c992fba061fc8732078 (mariadb-10.1.20-38-geb8d31d)
> parent(s): 905aac9c78068224839db551a84ed080167d1657
> author: Varun Gupta
> committer: Varun Gupta
> timestamp: 2017-01-15 19:40:46 +0530
> message:
>
> MDEV-10232: Scalar result of subquery changes after adding an outer select stmt
>
> postreview
>
> ---
> sql/sql_select.cc | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/sql/sql_select.cc b/sql/sql_select.cc
> index 13eda46..85bfb6b 100644
> --- a/sql/sql_select.cc
> +++ b/sql/sql_select.cc
> @@ -1614,7 +1614,8 @@ JOIN::optimize_inner()
> <fields> to ORDER BY <fields>. There are three exceptions:
> - if skip_sort_order is set (see above), then we can simply skip
> GROUP BY;
> - - if we are in a subquery, we don't have to maintain order
> + - if we are in a subquery, we don't have to maintain order unless there
> + is a limit clause in the subquery.
> - we can only rewrite ORDER BY if the ORDER BY fields are 'compatible'
> with the GROUP BY ones, i.e. either one is a prefix of another.
> We only check if the ORDER BY is a prefix of GROUP BY. In this case
> @@ -1626,7 +1627,7 @@ JOIN::optimize_inner()
> if (!order || test_if_subpart(group_list, order))
> {
> if (skip_sort_order ||
> - select_lex->master_unit()->item && !select_limit) // This is a subquery
> + (select_lex->master_unit()->item && select_limit == HA_POS_ERROR)) // This is a subquery
> order= NULL;
> else
> order= group_list;
> _______________________________________________
> commits mailing list
> commits@xxxxxxxxxxx
> https://lists.askmonty.org/cgi-bin/mailman/listinfo/commits
--
BR
Sergei
--
Sergei Petrunia, Software Developer
MariaDB Corporation | Skype: sergefp | Blog: http://s.petrunia.net/blog