Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I was confused by "select b from nums group by a;" indeed.

I am a little bit surprised by "select array[null] = array[null];" too.

The rest did seem like 'undefined behaviour' (or well-defined behaviour involving NULLs, literal-matching in the query planner [used in matching partial indexes too]...).



> select b from nums group by a;

MySQL allows selecting columns that don't appear in GROUP BY clause. It is not good and allows you to shoot yourself in the foot. Gives you false sense of correctness, because, well, query works.

It just takes _one_ arbitrary value you happen to have in b and selects it.

As I'm mostly working with MSSQL and sometimes have to shoot queries at MySQL - is there any mode / strictness I can set to error out on these kind of queries rather than silently continue?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: