Describe the bug
On a PostgreSQL-backed instance, the website Events page renders "Something went wrong". The request GET /api/websites/{id}/event-data/events (issued with no specific event selected) returns 500 with:
ERROR: column "website_event.event_name" must appear in the GROUP BY clause or be used in an aggregate function (SQLSTATE 42803)
Root cause
In src/queries/sql/events/getEventDataEvents.ts, the relational (Prisma) no-event branch selects count(*) alongside three non-aggregated columns but has no GROUP BY:
select
website_event.event_name as "eventName",
event_data.data_key as "propertyName",
event_data.data_type as "dataType",
count(*) as "total"
from event_data
inner join website_event
on website_event.event_id = event_data.website_event_id
where event_data.website_id = {{websiteId::uuid}}
and event_data.created_at between {{startDate}} and {{endDate}}
limit 500
The ClickHouse no-event branch in the same file does group (group by event_data.data_key, event_data.data_type, event_data.event_name), and the event-filtered relational branch has its own group by. So this only bites SQL backends: PostgreSQL always, MySQL with ONLY_FULL_GROUP_BY.
Verified directly against PostgreSQL 16 by running the exact shipped query.
Affected versions
3.2.0 and earlier 3.x. The same branch is still missing the GROUP BY on current master.
(Distinct from #3732, which was the WHERE-clause 42601 issue and is fixed.)
Suggested fix
Add the GROUP BY to the relational no-event branch, mirroring the other branches:
...
${filterQuery}
group by website_event.event_name, event_data.data_key, event_data.data_type
limit 500
Environment
- umami 3.2.0 (Docker,
ghcr.io/umami-software/umami:latest)
- PostgreSQL 16
Describe the bug
On a PostgreSQL-backed instance, the website Events page renders "Something went wrong". The request
GET /api/websites/{id}/event-data/events(issued with no specificeventselected) returns 500 with:Root cause
In
src/queries/sql/events/getEventDataEvents.ts, the relational (Prisma) no-event branch selectscount(*)alongside three non-aggregated columns but has noGROUP BY:The ClickHouse no-event branch in the same file does group (
group by event_data.data_key, event_data.data_type, event_data.event_name), and theevent-filtered relational branch has its owngroup by. So this only bites SQL backends: PostgreSQL always, MySQL withONLY_FULL_GROUP_BY.Verified directly against PostgreSQL 16 by running the exact shipped query.
Affected versions
3.2.0 and earlier 3.x. The same branch is still missing the
GROUP BYon currentmaster.(Distinct from #3732, which was the
WHERE-clause42601issue and is fixed.)Suggested fix
Add the
GROUP BYto the relational no-event branch, mirroring the other branches:... ${filterQuery} group by website_event.event_name, event_data.data_key, event_data.data_type limit 500Environment
ghcr.io/umami-software/umami:latest)