Skip to content

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 force-pushed the EmptyInlineCollection branch from 1a35931 to 2aad39c Compare November 26, 2023 22:58
@roji roji marked this pull request as ready for review November 26, 2023 23:04
@roji roji force-pushed the EmptyInlineCollection branch from 2aad39c to 456fe16 Compare November 27, 2023 07:32
@roji roji merged commit 01a470c into dotnet:main Nov 27, 2023
@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