Repository navigation
test: an empty VALUES without range or set columns keeps EF Core's behaviour - #264
Merged
Merged
Conversation
…haviour EmptyCollectionRewriter rewrites an empty VALUES only when a column read from it is a registered range or value set type (HoldsAPluginType), so a context configured for MultipleParameters keeps EF Core's own behaviour for a collection of plain values. Nothing held it: removing the guard passed every suite. EmptyCollectionGuardTests runs Any (with a predicate EF Core cannot turn into IN, and with one it can), Count and All over an empty List<int> under MultipleParameters with and without the plugin, and requires the same SQL or the same exception. Without the guard, Any and Count are rewritten where plain EF Core throws "Empty collections are not supported as inline query roots". Closes #252 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #252
Problem
EmptyCollectionRewriterrewrites an emptyVALUESonly when a column read from it is a registered range or value set type (HoldsAPluginType). The XML doc promises that a collection of other values, sent the same way by a context configured forMultipleParameters, keeps EF Core's own behaviour. No test held it: removing the guard passed all seven test projects.Change
A new test,
EmptyCollectionGuardTests, with no production change. It builds two contexts over an int-only entity, both underParameterizedCollectionMode = MultipleParameters, one withUseValueRanges()and one without. It runs four queries over an emptyList<int>and requires the same outcome, SQL text or exception, from both:Any(id => id > c.Id), which reads the collection fromVALUES;Any(id => id == c.Id), which EF Core turns intoINand so never reachesVALUES;Count(id => id > c.Id) == 0;All(id => id != c.Id).Tests
Anycase. Plain EF Core throwsInvalidOperationException: Empty collections are not supported as inline query roots., while the plugin wrote(VALUES (NULL::int)) … WHERE FALSE. TheCountcase shows the same split.🤖 Generated with Claude Code