Hacker News new | ask | show | jobs
by nikita 2781 days ago
Can you post the full schema and query? Are you sure you are not projecting columns that are not part of the group by expression?
1 comments

I really appreciate the offer. I got the go-ahead to share this information, where should I direct it?
Here, or https://www.memsql.com/forum/, or memsql-public.slack.com.
To close the loop on this one. We looked at the query and strictly speaking we should be rejecting it b/c HAVING clause is referencing a column that's NOT in group by and NOT an aggregate expression. The query shape is:

  select count(*), a from T group by a having b > 0
In this case b is not allowed to be part of having by ANSI standard.

We let it run b/c some customers migrate from MySQL and MySQL allows this query. You can set MemSQL to be strict about it by setting this variable:

  set session sql_mode = only_full_group_by;
Thanks for taking a look at it. Your position is perfectly reasonable, but given the fact that (at least in my case) the results I got back were subtly wrong, and there's a good chance someone wouldn't notice, it might be a good idea to default this off if it isn't already, with a really stern warning in the config.