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

Allow empty inline collections #32414

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Allow empty inline collections #32414

merged 1 commit into from
Nov 27, 2023

Conversation

roji
Copy link
Member

@roji roji commented Nov 26, 2023

Fixes #32375

We translate inline query roots to SQL VALUES, which doesn't support empty sets (there must be at least one element); so we had an early check to detect this and throw an informative exception.

However, in the Contains case, we pattern-match the ValuesExpression and optimize it away to an InExpression, so no actual VALUES gets sent to the database. This PR removes the check - allowing ValuesExpression to get get converted to InExpression - and moves the check for empty ValuesExpression to the SQL generation phase.

@roji roji requested a review from a team November 26, 2023 22:30
@roji roji marked this pull request as draft November 26, 2023 22:43
@roji roji marked this pull request as ready for review November 26, 2023 23:04
@roji roji merged commit 01a470c into dotnet:main Nov 27, 2023
7 checks passed
@roji roji deleted the EmptyInlineCollection branch November 27, 2023 08:17
roji added a commit to roji/efcore that referenced this pull request Nov 29, 2023
wtgodbe pushed a commit that referenced this pull request Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Did Contains stop working on empty list in EF Core 8?
2 participants