bug: GROUP BY fails on strict MySQL ONLY_FULL_GROUP_BY #59
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The site
LocationsModelusesGROUP BY a.idwhen joining to the categories junction table, but selects non-aggregated columns (title, address, etc.) that are not in the GROUP BY clause. This works on MySQL withONLY_FULL_GROUP_BYdisabled (the default on many hosts) but fails on strict mode.Error
Fix
Either:
ANY_VALUE()wrapper on non-grouped columnsOption 2 (EXISTS subquery for category filtering) is cleanest and avoids GROUP BY entirely.
Priority
P5 — only affects strict MySQL configurations, but should be fixed for compatibility.
Branch created:
feature/59-bug-group-by-fails-on-strict-mysql-only-Fixed in
site/src/Model/LocationsModel.php:INNER JOIN+ implicit GROUP BY withEXISTSsubquery for category filteringONLY_FULL_GROUP_BYstrict SQL mode