> > Thanks to a user query (handle: lltd, IRC) I came across a bug in the > > planner. The query was: > > > > --- > > select o1.timestamp::date as date, count(*), (select sum(oi.price) from > > "order" o2, "order_item" oi where oi.order_id = o2.id and > > o2.timestamp::date = o1.timestamp::date and o2.timestamp is not > > null) as total from "order" o1 where o1.timestamp is not null > > group by o1.timestamp::date order by o1.timestamp::date desc; > > --- > > > > The error he was receiving: > > > > --- > > ERROR: Sub-SELECT uses un-GROUPed attribute o1.timestamp from outer query > > --- > > > > After a bit of looking around, I determined that the cast in the order by > > clause was causing the error, not the fact that the query had an ungrouped
Mistake here. It relates to the group by clause, not order by. Gavin ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster