-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Parentheses put around IS NULL only if operand is of type boolean (6.0) #26652
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@roji You put |
@ajcvickers @smitpatel sorry, I confused this issue with something else in triage; the reason I put |
For the SQLite issue: SELECT TRUE <> (NULL IS NULL); -- returns 0
SELECT TRUE <> NULL IS NULL; -- return 1 |
@roji - Can you file a separate issue for 7.0 fix? (You can assign to me if you want) |
@smitpatel is that basically #23895? |
That issue has been fixed. You would need to file a new issue for this particular query if we plan to fix it differently. |
Well we'll definitely need to... I'd track it all under #23895 (correct parentheses around IS NULL, remove unneeded parentheses around AND/OR), but if you want to file something different go ahead. |
#23895 is about adding mechanism which is already done. |
Filed #26767. You probably need another one for the AND/OR simplification? |
React to dotnet/efcore#26652
#25722 fixed #23990 by adding parentheses around
IS NULL
/IS NOT NULL
, preventing operator precedence issues. However, it did so only when the operand ofIS NULL
is a bool. However, the same problem can happen if a non-bool column is being checked for null.See npgsql/efcore.pg#2090 on PostgreSQL where the following LINQ query:
... generates the following SQL ...
... which fails with
operator does not exist: boolean <> uuid
, because in PostgreSQL the precedence of<>
is higher than the precedence ofIS NOT NULL
(docs). The issue also causes wrong data to be returned in Sqlite.The text was updated successfully, but these errors were encountered: