Re: Denormalizing during select

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Denormalizing during select
Дата
Msg-id 12195.1046538812@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Denormalizing during select  (Edmund Lian <no.spam@address.com>)
Список pgsql-sql
Edmund Lian <no.spam@address.com> writes:
> Answering my own question: kind of. The problem with custom aggregates
> is that they need to be used with a "group by" clause, and this means
> that the select cannot return columns that are not aggregates of some
> kind. What I'm trying to return are rows that are a combination of
> columns and aggregates.

This strikes me as evidence of fuzzy thinking.  What sets of rows are
the aggregates taken over?  Which column values within those sets of
rows do you expect the non-aggregated column references to return?
If the columns aren't the ones grouped by, seems like you have an
inherently undefined result.

If you know for some reason that there will be only one unique value
of a column in a grouped row set, or you don't actually much care which
one you get, then you could use MIN() or MAX() on the column reference
to make it look like a kosher query.
        regards, tom lane


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

Предыдущее
От: Rod Taylor
Дата:
Сообщение: Re: Denormalizing during select
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Denormalizing during select