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

Cosmos: remove automatic composition of discriminator filter in raw SQL queries #26292

Merged
merged 1 commit into from
Oct 13, 2021

Conversation

roji
Copy link
Member

@roji roji commented Oct 9, 2021

Closes #26124

Description

When executing a Cosmos raw SQL query, EF Core automatically appends the discriminator filter corresponding to the DbSet queried. If the discriminator projected by the user doesn't correspond to it, no rows are return. This PR removes the automatic discriminator filter, causing an exception to be thrown instead by the materializer.

Customer impact

If the user forgets to project out a discriminator in a Cosmos raw SQL, currently no rows at all are returned by the query (rather than throwing an exception). This is a case of incorrect results which is somewhat hard to diagnose.

How found

Flagged by @JeremyLikness in #26124

Regression

No, Cosmos FromSql is a new feature introduced in 6.0.

Testing

Yes, introduced in this PR.

Risk

Low, the fix is trivial and affects a new feature (FromSql)

@roji roji requested a review from a team October 9, 2021 10:26
@ajcvickers
Copy link
Member

@roji Merge to release/6.0? (I changed the default to main this morning.)

@roji roji changed the base branch from main to release/6.0 October 9, 2021 10:36
@roji roji marked this pull request as draft October 9, 2021 10:36
@roji
Copy link
Member Author

roji commented Oct 9, 2021

@ajcvickers thanks, rebased. Still need to check up on a few things.

@roji roji force-pushed the EndAllDiscrimination branch 2 times, most recently from 56ae0dd to 8b1f790 Compare October 10, 2021 15:06
@roji roji marked this pull request as ready for review October 10, 2021 17:00
@roji
Copy link
Member Author

roji commented Oct 11, 2021

@smitpatel ready for review

@roji
Copy link
Member Author

roji commented Oct 11, 2021

/cc @Pilchie for GA

@Pilchie
Copy link
Member

Pilchie commented Oct 12, 2021

Approved for EFCore 6.0 GA.

@ajcvickers
Copy link
Member

@roji Is there any reason you are holding off merging this? Would be good to get it into the daily builds.

@roji
Copy link
Member Author

roji commented Oct 13, 2021

@ajcvickers not at all - was just waiting for the approval above (from @AndriySvyryd). Merging now.

@roji roji merged commit d5a7cce into release/6.0 Oct 13, 2021
@roji roji deleted the EndAllDiscrimination branch October 13, 2021 07:39
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.

Cosmos: remove automatic composition of discriminator filter in raw SQL queries
4 participants