Greg Donald <destiney(at)gmail(dot)com> writes:
> On Wed, 15 Sep 2004 12:55:24 -0400, Jean-Luc Lachance
> <jllachan(at)sympatico(dot)ca> wrote:
>> Add :
>> AND count(user_tasks.task_id) > 0 in the where clause.
> I get the error:
> aggregates not allowed in WHERE clause
You need to put it in HAVING, instead.
Note also this 7.4.4 bug fix:
* Check HAVING restriction before evaluating result list of an aggregate plan
which means that this isn't really gonna work unless you are on 7.4.5.
(It's fairly astonishing that no one noticed we were doing this in the
wrong order until recently, but no one did ...)
regards, tom lane