Re: ERROR: ExecEvalAggref

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: ERROR: ExecEvalAggref
Дата
Msg-id
20189.1043821819@sss.pgh.pa.us
Ответ на
ERROR: ExecEvalAggref (eric soroos)
Список
Дерево обсуждения
ERROR: ExecEvalAggref eric soroos <eric-psql@soroos.net>
Re: ERROR: ExecEvalAggref Tom Lane <tgl@sss.pgh.pa.us>
Re: ERROR: ExecEvalAggref eric soroos <eric-psql@soroos.net>
eric soroos  writes:
> update dl_profile set
>         city= profiler(concat(dl_event._eventDate,dl_event.city))::text
>         from dl_event where dl_event._donorNum='385'
>         and dl_profile._donorNum='385'
>         and dl_event._flDeleted='f'
> ERROR:  ExecEvalAggref: no aggregates in this expression context

In general, aggregates at the top level of an UPDATE are ill-defined
(the SQL spec prohibits them outright, and probably we should too).
You will realize the problem when you ask yourself "exactly what
set of rows is the aggregate aggregating over?  How would I control
what that set is, separately from controlling which rows of dl_profile
get updated?"

You will perhaps have better luck with a query structured like

	update dl_profile set
	city = (select profiler(...) from ... where FOO)
	where BAR

Here, FOO controls the set of rows aggregated over, and BAR defines
what set of rows of dl_profile get updated.  Note you can use
outer references to the current row of dl_profile in the sub-select.

			regards, tom lane
В списке pgsql-general по дате отправления
От: Shridhar Daithankar<shridhar_daithankar@persistent.co.in>
Дата:
Сообщение: Re: Help with I/O statistics
От: Martin Kutschker
Дата:
Сообщение: Re: How do I unsubscribe?
FAQ