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

Fix to #30326 - Query: converter from bool used in predicate without comparison fails on sqlite (and other non-sql server backends?) #30666

Merged
merged 1 commit into from
Apr 14, 2023

Conversation

maumar
Copy link
Contributor

@maumar maumar commented Apr 12, 2023

SqlServer doesn't have the problem because search condition replacing visitor already converts all bool values in the predicate into conditions. Fix is to re-purpose this visitor to be used by other providers also and convert bool values to conditions when they have a converter.

Fixes #30326

@maumar maumar requested a review from roji April 12, 2023 02:12
Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we already deal with this for non-JSON cases in RelationalValueConverterCompensatingExpressionVisitor - is there simply a bug in that visitor when the expression happens to be JSON? In any case, it doesn't seem like we should have two places dealing with the bool+value converter case, if possible...

Unrelated General question... Is there a reason we need to run SearchConditionConvertingExpressionVisitor in RelationalParameterBasedSqlProcessor, rather than in RelationalQueryTranslationPostprocessor? It doesn't seem to need to look at any parameter values, is there some ordering dependency where it must run after e.g. the nullability processor? I'm asking since this PR now introduces this additional visitation for all providers (not just SQL Server), and the parameter-based processor gets invoked again for different parameter nullabilities etc. (not critical and can be done separately)

@maumar
Copy link
Contributor Author

maumar commented Apr 12, 2023

@roji updated. Much better and simpler change. Thanks for the hint!

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! We should consider patching...

@maumar maumar force-pushed the fix30326 branch 2 times, most recently from 0e6be52 to e5edcb8 Compare April 13, 2023 20:08
…comparison fails on sqlite (and other non-sql server backends?)

RelationalValueConverterCompensatingExpressionVisitor was not compensating for bool values with converters for JsonScalarExpression.

Fixes #30326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants