Re: division by zero issue

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Donald <destiney(at)gmail(dot)com>
Cc: Jean-Luc Lachance <jllachan(at)sympatico(dot)ca>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: division by zero issue
Date: 2004-09-15 18:01:23
Message-ID: 5853.1095271283@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron St-Pierre 2004-09-15 18:05:38 Re: disk performance benchmarks
Previous Message Bruno Wolff III 2004-09-15 18:00:09 Re: Boxes