I have a case where XOR returns true for a condition where OR returns false. This should never be the case.
The query looks odd because it is generated using Entity Framework in .Net.
The full explanation of the issue is a bit long for this post, but I'll summarize below (full post at
http://stackoverflow.com/questions/38895765/mysql-or-operand-is-broken)
select *,
(SELECT `Project2`.`id`
FROM `ldz_from_rec` AS `Project2`
/* the next line returns results */
WHERE (`Distinct1`.`region` = `Project2`.`region`) XOR ((`Distinct1`.`region` IS NULL) AND (`Project2`.`region` IS NULL))
/* the next line does not return results */
/*WHERE (`Distinct1`.`region` = `Project2`.`region`) OR ((`Distinct1`.`region` IS NULL) AND (`Project2`.`region` IS NULL))*/
ORDER BY
`Project2`.`LDZ_Exit` ASC LIMIT 1) AS `id`
from (SELECT DISTINCT
`Extent1`.`region`
FROM `ldz_from_rec` AS `Extent1`) as `Distinct1` ;
The problem started when we upgrading a server to 5.7. We have another server running 5.6 which handles the query correctly.
I upgraded my .Net Entity Framework, but the query is the same.
I haven't got any response on other forums I have posted to, so I'm hoping that this is a known issue that I just can't find by myself.
Thanks ^_^