Aggregate in Correlated SubQuery

Поиск
Список
Период
Сортировка
От Niederland
Тема Aggregate in Correlated SubQuery
Дата
Msg-id 1160897019.236535.38970@b28g2000cwb.googlegroups.com
обсуждение исходный текст
Ответы Re: Aggregate in Correlated SubQuery  ("Niederland" <niederland@gmail.com>)
Список pgsql-general
Before postgresql 8.1.5, I could do the following to find the first
lead that created a prospect in my application.

SELECT
  Lead.LeadID,
  Prospect.ProspectID
FROM
  Prospect INNER JOIN Lead USING (ProspectID)
WHERE
  Lead.CreationDate = (SELECT MIN(Lead.CreationDate) FROM Lead AS LL
WHERE LL.ProspectID = Lead.ProspectID)

With 8.1.5 this now generates:
ERROR: aggregates not allowed in WHERE clause
SQL state: 42803

Shouldn't aggregate functions still work within correlated subQueries?
I saw in the 8.1.5 release notes that this was disabled due to crashes
this caused in 8.1.X versions for Postgresql.  I have never experienced
this with queries similar to the above.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: more anti-postgresql FUD
Следующее
От: Ian Dowse
Дата:
Сообщение: Same-page UPDATEs in bloated tables