Eng 6436 distinct reroute

This is the fast, simple but not the best efficient solution for DISTINCT with GROUP BY cases. We will create tickets to optimize it later.
Do we have junit tests that demonstrate that HSQL has this guard?
I don't think that HAVING with no GROUP BY is disallowed by the sql standard.
It's not totally useless -- it can prevent a non-interesting trivial row from being returned.
select min(X), max(X) from table having min(X) > 0
Maybe HSQL will support it someday. It would be good to have a junit that would detect that.