Skip to content
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

Relational: IS (NOT) NULL requires parenthesis when not in left side of an equality #23990

Closed
smitpatel opened this issue Jan 26, 2021 · 0 comments · Fixed by #25722
Closed
Assignees
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@smitpatel
Copy link
Member

Details PomeloFoundation/Pomelo.EntityFrameworkCore.MySql#1309

Mainly any operator which is assigned to result of SqlUnaryExpression (representing only above operators) requires brackets to specify that IS NULL should be applied first. It works by chance for most basic case of a IS NULL == true

@maumar maumar self-assigned this Jan 28, 2021
@ajcvickers ajcvickers added this to the 6.0.0 milestone Jan 29, 2021
maumar added a commit that referenced this issue Aug 26, 2021
…ot in left side of an equality

We were generating incorrect sql when comparing bool value to a nullableBool.HasValue. Fix is to add parentheses to the right side when we detect the pattern:
- left side doesn't already have parentheses
- right side is a IS NULL / IS NOT NULL check
- argument to that null check is bool

Note: this is not really an issue for sql server because of search conditions, but sqlite would yield incorrect data for those queries.

Fixes #23990
@maumar maumar added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 26, 2021
maumar added a commit that referenced this issue Aug 26, 2021
…ot in left side of an equality

We were generating incorrect sql for some cases involving nullability check on nullable bool. E.g. true = someBool IS NULL. Instead we need true = (someBool IS NULL)
Note: this is not really an issue for sql server because of search conditions, but sqlite would yield incorrect data for those queries.

Fixes #23990
@maumar maumar closed this as completed in d30d9ea Aug 26, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0, 6.0.0-rc2 Aug 27, 2021
@ajcvickers ajcvickers modified the milestones: 6.0.0-rc2, 6.0.0 Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
3 participants