-
Guilhem Bichot authored
ONLY_FULL_GROUP_BY SQL MODE". The root problem is that ONLY_FULL_GROUP_BY mode raises an error on SELECT (subq) GROUP BY (same subq); It does not recognize that both subqueries are the same. Fixing this root cause is too difficult: it would require implementing Item_subselect::eq(); and it's not worth the effort because: a) GROUP BY (subquery) is non-SQL-standard so is likely of very little interest to users of ONLY_FULL_GROUP_BY b) as the user uses ONLY_FULL_GROUP_BY, he wants to have the same subquery in GROUP BY and SELECT list, so can give the subquery an alias in the SELECT list and use this alias in GROUP BY, thus avoiding the problem. Back to the bug report: a view is created as SELECT (subq) AS field2 GROUP BY field2; Such SELECT, when run standalone, is accepted by ONLY_FULL_GROUP_BY. But when used in a view, the SELECT is written to the view's frm file (= what will be the view's definition) as: SELECT (subq) AS field2 GROUP BY...
Guilhem Bichot authoredONLY_FULL_GROUP_BY SQL MODE". The root problem is that ONLY_FULL_GROUP_BY mode raises an error on SELECT (subq) GROUP BY (same subq); It does not recognize that both subqueries are the same. Fixing this root cause is too difficult: it would require implementing Item_subselect::eq(); and it's not worth the effort because: a) GROUP BY (subquery) is non-SQL-standard so is likely of very little interest to users of ONLY_FULL_GROUP_BY b) as the user uses ONLY_FULL_GROUP_BY, he wants to have the same subquery in GROUP BY and SELECT list, so can give the subquery an alias in the SELECT list and use this alias in GROUP BY, thus avoiding the problem. Back to the bug report: a view is created as SELECT (subq) AS field2 GROUP BY field2; Such SELECT, when run standalone, is accepted by ONLY_FULL_GROUP_BY. But when used in a view, the SELECT is written to the view's frm file (= what will be the view's definition) as: SELECT (subq) AS field2 GROUP BY...
Loading