Re: We are not following the spec for HAVING without GROUP BY

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: We are not following the spec for HAVING without GROUP BY
Date: 2005-03-10 03:46:26
Message-ID: 87acpc5fjh.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers


Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> In particular this whole business of "moving HAVING into WHERE" is
> wrong and should go away.

It sort of seems like "select aggregate(col) from tab" with no GROUP BY clause
is a bit of a special case. The consistent thing to do would be to return no
records. It's only due to the special case that SQL returns a single record
for this case.

It seems like this special case is the only way to expose this difference
between a WHERE clause and a HAVING clause with an aggregate-free expression.

It seems like all that's needed is a simple flag on the Aggregate node that
says whether to output a single record if there are no input records or to
output no records.

--
greg

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Christopher Kings-Lynne 2005-03-10 04:00:26 Re: We are not following the spec for HAVING without GROUP
Previous Message Kevin Brown 2005-03-10 03:30:08 Re: We are not following the spec for HAVING without GROUP BY

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2005-03-10 03:47:52 Re: One vacuum full is not enough.
Previous Message Kevin Brown 2005-03-10 03:30:08 Re: We are not following the spec for HAVING without GROUP BY