>> If I look in our crash-me output page (this is a handy thing for this
>> kind of questions) and look for all the other db's to see what they
>> do I can say the following thing:
>> Informix,Access,Adabas,db2,empress,ms-sql,oracle,solid and
>> sybase are all supporting non-aggregation in having clause.
>> At this moment everyone except postgres is supporting it.
> Maybe we should support the HAVING without aggregates. What do others
> think?
Kinda looks like we gotta, just for compatibility reasons. Also, if I
read the SQL spec correctly, it does not forbid HAVING w/out aggregates,
so those guys are adhering to the spec.
I'll put it on my todo list --- I'm busy making some other fixes in that
general area anyway.
Next question is should we emit a NOTICE or just silently do it?
(For that matter, should we go so far as to push the HAVING condition
over to become part of WHERE when it has no agg? Then the speed issue
goes away.) I kind of like emitting a NOTICE on the grounds of helping
to educate users about the difference between WHERE and HAVING, but
maybe people would just see it as obnoxious.
regards, tom lane