Ordering of records in group by not possible

Поиск
Список
Период
Сортировка
От Chris Kratz
Тема Ordering of records in group by not possible
Дата
Msg-id 200604260919.41197.chris.kratz@vistashare.com
обсуждение исходный текст
Ответы Re: Ordering of records in group by not possible  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Ordering of records in group by not possible  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
Hello all,

I wanted to verify what we are seeing.

Select a, aggregate(b)
from c
group by a
order by a,b

Is not accepted by postgres.  This will only work if you order by a.  But,
this means that the records that are grouped are processed in no apparent
order.

We have some custom aggregate functions where the order of the rows is
important.  Is there no way to do this without a subselect?

select a,aggregate(b)
from (
   select a,b
   from c
   order by a,b
) as foo
group by a
order by a

Even with a subselect doing the ordering ahead of time, is there any
guarrantee that the records will be processed in the group by with the
specified order?  Or will the group by always be arbitrary in it's ordering
of the records?

This is pg 8.1 on Linux.

Thanks,

-chris
--
Chris Kratz

В списке pgsql-general по дате отправления:

Предыдущее
От: Reid Thompson
Дата:
Сообщение: Linux Journal article - Open source baseball stats web site will use PostgreSQL
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Ordering of records in group by not possible