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.1] Query: Don't terminate translation if indexer method does not bind to indexer property #23420

Merged
merged 1 commit into from
Nov 24, 2020

Conversation

smitpatel
Copy link
Member

@smitpatel smitpatel commented Nov 20, 2020

Resolves #23410

Description

in EF Core 5.0, we added support for indexer properties. As a part of translating indexer properties, we intercepted them and tried to identify them in model. If not found, we would terminate translation. In earlier versions, this would actually go into further translation treating indexer access as just a normal method call. There are custom extensions/plugins out there that utilize this (it reported on the MySQL provider, PostgreSQL is also impacted) and provide support for JSON mapping to database as in JSON dictionary, tokens are accessed using indexer.

Customer Impact

Customers which were using indexer by custom mapping or through 3rd party libraries will start having errors in using indexers in their queries without any work-around. This was reported against the Pomelo MySQL provider and we believe it also impacts the PostgreSQL provider, both of which are popular, and JSON support is a popular feature of those providers.

How found

Reported by the author of the Pomelo MySQL provider, since it breaks their provider. (See #23410)

Test coverage

We have added a test to verify that we don't terminate the translation and evaluate the earlier method call translation pipeline. We have mimicked a behavior a library trying to add translation for JSONs by registering services and verified that it translates correctly. In addition, we have provided the fix to the author of the MySQL provider and he has verified that the this change fixes the issue--see #23410 (comment)

Regression?

Yes, in 3.1 indexers passed through method call translators. New feature in 5.0 skipped that.

Risk

Low. Currently we terminate right away. After this fix, we would go through the method call translators. If they don't handle indexers then they would return null anyway. The only place where this could cause error if an external method call translators is not identifying their method correctly and incorrectly ends up matching an indexer method. This is unlikely, and would be a bug in the calling code that would fail on 3.1. It currently silently passes on 5.0.0, but will go back to failing in 5.0.1, which was the 3.1 behavior. There is also quirk added in case to go back to 5.0.0 behavior.

@smitpatel smitpatel changed the base branch from main to release/5.0 November 20, 2020 22:16
@smitpatel smitpatel marked this pull request as ready for review November 23, 2020 21:28
@smitpatel smitpatel requested a review from a team November 23, 2020 21:36
@ajcvickers ajcvickers changed the title [5.0.1] Query: Don't terminate translation if indexer method does not bind to… [5.0.1] Query: Don't terminate translation if indexer method does not bind to indexer property Nov 23, 2020
@ajcvickers ajcvickers added this to the 5.0.x milestone Nov 23, 2020
@ajcvickers ajcvickers modified the milestones: 5.0.x, 5.0.1 Nov 23, 2020
@smitpatel smitpatel merged commit 8f844ce into release/5.0 Nov 24, 2020
@smitpatel smitpatel deleted the smit/helpingMySql branch November 24, 2020 16:55
@ajcvickers ajcvickers removed this from the 5.0.1 milestone Dec 11, 2020
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.

Provider specific plugin method translator never gets called for indexer property
3 participants