Re: Attribute must be GROUPed.... ?

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Attribute must be GROUPed.... ?
Дата
Msg-id 20030430144643.O95283-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Attribute must be GROUPed.... ?  (Daniele Orlandi <daniele@orlandi.com>)
Ответы Re: Attribute must be GROUPed.... ?
Список pgsql-hackers
On Wed, 30 Apr 2003, Daniele Orlandi wrote:

> I always had been doubious about the "must" in the error message
> "Attribute must be GROUPed or used in an aggregate function".

AFAIK it's a requirement of the SQL spec. (SQL92(draft) 7.9 SR 7, "each
<column reference> in each <value expression> that references a column
of T shall reference a grouping column or be specified within a <set
function specification>."

> For example, suppose that you join two tables and the field you group by
> appears to be the primary key of one of the tables. In this case if I
> put any of the fields in that table in the target list, it will always
> be well defined and would make certain queries much simpler.

Well, it'd mean you didn't have to put the extra columns in the group by
list to make them grouping columns.



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

Предыдущее
От: Daniele Orlandi
Дата:
Сообщение: Attribute must be GROUPed.... ?
Следующее
От: Daniele Orlandi
Дата:
Сообщение: Re: Attribute must be GROUPed.... ?