From: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Postgres Planner Bug |
Date: | 2002-10-01 04:34:03 |
Message-ID: | Pine.LNX.4.21.0210011416330.13713-100000@linuxworld.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
> > 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-10-01 04:40:35 | Re: Postgres Planner Bug |
Previous Message | Bruce Momjian | 2002-10-01 03:48:35 | Re: Postgres Planner Bug |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-10-01 04:40:35 | Re: Postgres Planner Bug |
Previous Message | Bruce Momjian | 2002-10-01 03:48:35 | Re: Postgres Planner Bug |