-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query: improve optimization of "false==(expr)" #23121
Comments
@dmitry-lipetsk Curious, what is the reason for writing these queries in a way that is not at all idiomatic to C#? For example, the first thing I would do if I saw this |
Hm.... Google translate of answer: We bought a Japanese chainsaw for some harsh Siberian lumberjacks. |
Sir Humphrey: I put it to you, Minister, that you are looking a Trojan horse in the mouth. |
@maumar to decide whether to keep this open as a backlog enhancement or not. |
When optimizing false == x -> !x we were not running optimization for the Not that we just created, like we do for x == false
Hello,
EFCore: main (no changes in your generation logic).
DataProvider: my own.
I've tested two equal linq expressions and your SQL generator generated two correct, but slightly different SQLs.
I think, your compiler may create two identical SQLs for both cases.
Context
TEST1 - (expr)==false
var recs1=db.testTable.Where(r => (!(r.DATA==null))==false && r.TEST_ID==testID);
SQL:
Looks OK.
TEST2 - false==(expr)
var recs2=db.testTable.Where(r => false==(!(r.DATA==null)) && r.TEST_ID==testID);
SQL:
Condition "NOT ("t"."COL_VARCHAR_10" IS NOT NULL)" is correct, but looks a little strange :)
Perhaps this research will be useful for improving EFCore.
The text was updated successfully, but these errors were encountered: