Re: Postgres Planner Bug
От | Gavin Sherry |
---|---|
Тема | Re: Postgres Planner Bug |
Дата | |
Msg-id | Pine.LNX.4.21.0210011416330.13713-100000@linuxworld.com.au обсуждение исходный текст |
Ответ на | Re: Postgres Planner Bug (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-hackers |
> > 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
В списке pgsql-hackers по дате отправления: