A scalar subquery over a grouping expression
Group bookings by facility_id % 3. The subquery refers to the grouping expression, which PostgreSQL 18 rejected as an ungrouped column.
task
Per group g = facility_id % 3 show g, the name of facility (g + 1) via a scalar subquery, and count(*).