-
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
Translation error using negative #13919
Comments
@smitpatel @maumar it looks like in |
For what it’s worth, the in-memory database does not have this problem (which is why my own attempts to reproduce this failed 😅) |
@poke @tuespetre Actually I just realised that I'm using Z.EntityFramework.Plus Future query feature which might have the issue. I have opened up an issue there in case it's their issue more than entity framework?
|
No, I was able to reproduce the problem eventually with the SQLite provider. |
@poke Ahh that's awesome news, cheers hopefully the EF team will get on top of this. Could be pretty critical for some apps |
Probably this still exist in new pipeline. Also look for other operatorType in SqlUnary. |
@smitpatel I would like to contribute to the EF Core project and believe this issue is a suitable entry point. I took a look and was able to verify that this issue still exists for SQL Server and SQLite. Is it currently up for grabs? |
create negation unit tests add parentheses to negated expression on translation expose unit test to sqlite test suite add unit tests for negating a column and LIKE expression use RequiresBrackets helper Fixes #13919
Trying to sum a list of numbers and apply a negative value to it.
Seems like a translation issue?
Steps to reproduce
Summing up a list of rows in a transaction table
Basically I needed the negative value of a sum, it turns out it was actually giving me -180 instead of -220
Instead I did -1 * (1 * 200 + 20) and it gave the right result not sure why?
Using a linq sample gives the correct values
Further technical details
EF Core version: 2.1.4
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.8.9
The text was updated successfully, but these errors were encountered: