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

[5.0.3] Fix to #23617 - IQueryable.All evaluate to false with predicate _ => true #23810

Merged
merged 1 commit into from
Jan 13, 2021

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Jan 5, 2021

We have optimization for EXISTS, that returns false when the subquery has a predicate which filters out all the rows. In such case we return constant false. However, ExistExpression also stores information about it being negated or not (i.e. EXISTS vs NOT EXISTS).
If the Exists expression is negated and the predicate filters out all the rows we should return true instead.

Fixes #23617

@maumar
Copy link
Contributor Author

maumar commented Jan 5, 2021

Description

We have optimization for EXISTS, that returns false when the subquery has a predicate which filters out all the rows. In such case we return constant false. However, ExistsExpression also stores information about it being negated or not (i.e. EXISTS vs NOT EXISTS).
If the Exists expression is negated and the predicate filters out all the rows we should return true instead.

Customer Impact

Basic query: entities.All(x => true) returns incorrect result. The query is not very useful, but it always returns the wrong result.

How found

Customer reported on 5.0.1.

Test coverage

We have added test coverage in this PR.

Regression?

Yes, from 3.1

Risk

Low. Fix only affects one codepath which involves small SQL optimization of one particular scenario. Also added quirk to revert to earlier behavior.

…true

We have optimization for EXISTS, that returns false when the subquery has a predicate which filters out all the rows. In such case we return constant false. However, ExistExpression also stores information about it being negated or not (i.e. EXISTS vs NOT EXISTS).
If the Exists expression is negated and the predicate filters out all the rows we should return true instead.

Fixes #23617
@ajcvickers ajcvickers added this to the 5.0.x milestone Jan 5, 2021
@ajcvickers ajcvickers merged commit 2044a3c into release/5.0 Jan 13, 2021
@ajcvickers ajcvickers deleted the fix23617_50 branch January 13, 2021 23:38
@ajcvickers ajcvickers removed this from the 5.0.x milestone Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants