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

Convert integral value to enum value when printing Sql literal #16692

Merged
merged 1 commit into from
Jul 22, 2019

Conversation

smitpatel
Copy link
Contributor

@smitpatel smitpatel commented Jul 22, 2019

In new query pipeline, we preserve convert nodes around enum in expression tree and remove them on both sides when translating to server.
The typeMapping for enum column expects an enum value for constant or parameter

  • With new pipeline, we will have parameter's value to be enum so we no long need any additional code for conversion
  • For constants, there is no convert node around constant in actual tree so we are left with integral value to be printed with Enum type mapping. Hence we need to convert it to actual enum value first. Afterwards, provider can print enum literal or apply appropriate conversions

In new query pipeline, we preserve convert nodes around enum in expression tree and remove them on both sides when translating to server.
The typeMapping for enum column expects an enum value for constant or parameter
- With new pipeline, we will have parameter's value to be enum so we no long need any additional code for conversion
- For constants, there is no convert node around constant in actual tree so we are left with integral value to be printed with Enum type mapping. Hence we need to convert it to actual enum value first. Afterwards, provider can print enum literal or apply appropriate conversions
@smitpatel
Copy link
Contributor Author

This was causing a failure in Npgsql since it natively supports enum. Our code was not converting int to enum when there is no converter. No regression tests since we don't have a provider which supports enum without a converter.

@smitpatel smitpatel merged commit 9cc38f6 into master Jul 22, 2019
@smitpatel smitpatel deleted the smit/enumliterals branch July 22, 2019 19:13
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.

2 participants