[MDEV-24239] ONLY_FULL_GROUP_BY not restricting ORDER BY Created: 2020-11-18  Updated: 2020-11-18  Resolved: 2020-11-18

Status: Closed
Project: MariaDB Server
Component/s: Parser
Affects Version/s: 10.5.8
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Yitzchak Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-11588 Support for ONLY_FULL_GROUP_BY functi... Stalled

 Description   

ONLY_FULL_GROUP_BY does not appear to be restricting ORDER BY when I would have thought it would. For example, in the following, the ORDER BY specifies a non-grouped column leading to non-determinate results:

create table documentdb (timestamp datetime, filename text) select now() timestamp, 'foo' filename union all select now() - interval 2 minute, 'foo' union all select now() - interval 1 minute, 'bar';
set session sql_mode=concat('only_full_group_by,',@@sql_mode);
select filename from documentdb group by filename order by timestamp desc limit 10;

produces

foo
bar

mysql 8 gives an error, as I would have expected mariadb to do: "Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'db_116865070.documentdb.timestamp' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by"



 Comments   
Comment by Alice Sherepa [ 2020-11-18 ]

Thanks for the report! It is a part of MDEV-11588 task, expected to be fixed in 10.6

Generated at Thu Feb 08 09:28:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.