The issue involves a SQL query that needs adjustment to comply with strict SQL mode rules.
The issue arises from a SQL query in Frappe that fails under strict SQL mode `ONLY_FULL_GROUP_BY`. The query needs to be adjusted to either aggregate or include all selected fields in the `GROUP BY` clause. The fix is localized to a specific method in the codebase.
When opening the /app/user-profile page, Frappe throws the following SQL error: pymysql.err.OperationalError: (1055, "tabEnergy Point Log.creation' isn't in GROUP BY").
This happens because my MariaDB/MySQL instance is running with the SQL mode ONLY_FULL_GROUP_BY enabled.
In this mode, MySQL requires that all selected fields be either aggregated or included in the GROUP BY clause.
The problematic query is generated inside: /apps/frappe/frappe/desk/page/user_profile/user_profile.py => get_energy_points_heatmap_data method.
This query selects:
UnixTimestamp(Date(eps_log.creation)) (not aggregated)Sum(eps_log.points) (aggregated)…but only groups by Date(eps_log.creation), which results in SQL error 1055 under strict mode.
ONLY_FULL_GROUP_BY in the SQL server configuration (workaround).MAX() around the timestamp expression or grouping by the exact expression used in the SELECT).**Output
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!