Search code examples
mysqloperator-keywordnegate

MySQL 5.x - Can you explain this weirdness?



Running the query ...

SELECT !(!0), ! !0, !!0 AS WTF;

in MySQL yields the following output ...

-------------------------
  !(!0) |  ! !0  |  WTF  
-------------------------
     0  |    0    |  1     # <- What's going on here?

I can't seem to find anything in the Docs that would explain this. Can you?


Solution

  • That's a known bug in mysql regarding operator parsing.