Commit c80f9a33 authored by Galina Shalygina's avatar Galina Shalygina

Changed handling of mergeable views/derived tables of one table.

parent f089a900
......@@ -4395,13 +4395,16 @@ FROM t1 LEFT JOIN (
SELECT t2.c,COALESCE(t2.c,2) as x FROM t2) AS d
ON 1
GROUP BY d.c;
ERROR 42000: Non-grouping field 'x' is used in SELECT list
c x
NULL 2
2 2
SELECT d.c,d.x
FROM t1 LEFT JOIN (
SELECT t2.c,COALESCE(t2.c,2) as x FROM t2) AS d
ON 0
GROUP BY d.c;
ERROR 42000: Non-grouping field 'x' is used in SELECT list
c x
NULL NULL
SELECT t1.a,d.c,d.x
FROM t1 LEFT JOIN (
SELECT t2.c,COALESCE(t2.c,2) as x FROM t2) AS d
......
......@@ -3924,14 +3924,12 @@ FROM t1 LEFT JOIN (
ON (t1.a > 0)
GROUP BY d.c;
--error ER_NON_GROUPING_FIELD_USED
SELECT d.c,d.x
FROM t1 LEFT JOIN (
SELECT t2.c,COALESCE(t2.c,2) as x FROM t2) AS d
ON 1
GROUP BY d.c;
--error ER_NON_GROUPING_FIELD_USED
SELECT d.c,d.x
FROM t1 LEFT JOIN (
SELECT t2.c,COALESCE(t2.c,2) as x FROM t2) AS d
......
......@@ -825,7 +825,9 @@ bool expand_fdfs_with_join_tables_fields(FD_select_info *sl_info,
TABLE_LIST *tbl= dep_tabs.elem(i);
if (!tbl->on_expr)
continue;
if (tbl->nested_join && expand_fdfs_with_join_tables_fields(sl_info, tbl))
if (tbl->nested_join &&
(tbl->nested_join->join_list.elements > 1) &&
expand_fdfs_with_join_tables_fields(sl_info, tbl))
return true;
else if (tbl->table)
{
......@@ -902,7 +904,7 @@ bool expand_fdfs_with_top_join_tables_fields(FD_select_info *sl_info)
TABLE_LIST *tbl= dep_tabs.elem(i);
if (!tbl->on_expr)
continue;
if (tbl->nested_join)
if (tbl->nested_join && (tbl->nested_join->join_list.elements > 1))
{
if (tbl->outer_join & JOIN_TYPE_LEFT)
sl_info->top_level= false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment