Opened 5 months ago

Last modified 5 months ago

#31331 new Bug

GROUP BY optimization doesn't work properly when ONLY_FULL_GROUP_BY mode is enabled on MySQL.

Reported by: felixxm Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords: ONLY_FULL_GROUP_BY MySQL MariaDB
Cc: Simon Charette, Adam (Chainz) Johnson Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

GROUP BY optimization doesn't work properly when ONLY_FULL_GROUP_BY mode is enabled on MySQL/MariaDB (default on MySQL 5.7+) and can cause:

(1055, "Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'TABLE.COLUMN' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by")

See tests.aggregation.tests.AggregateTestCase.test_aggregation_subquery_annotation_multivalued().

Change History (4)

comment:1 Changed 5 months ago by Simon Charette

Cc: Simon Charette added

comment:2 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In a19505eb:

Refs #31331 -- Added DatabaseWrapper.sql_mode to MySQL.

comment:3 Changed 5 months ago by Mariusz Felisiak <felisiak.mariusz@…>

In aee0beb:

Refs #31331 -- Checked ONLY_FULL_GROUP_BY mode in AggregateTestCase.test_aggregation_subquery_annotation_multivalued().

comment:4 Changed 5 months ago by Adam (Chainz) Johnson

Cc: Adam (Chainz) Johnson added
Note: See TracTickets for help on using tickets.
Back to Top