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

Allow changing CLR type in query translation without additional SQL #33733

Open
roji opened this issue May 16, 2024 · 0 comments
Open

Allow changing CLR type in query translation without additional SQL #33733

roji opened this issue May 16, 2024 · 0 comments

Comments

@roji
Copy link
Member

roji commented May 16, 2024

In some rare cases, during query translation we want to change the CLR type, but without an actual SQL conversion being necessary. For example, if an enum that's value-converted to string has ToString() called on it, nothing needs to be done in SQL (the database value is already a string), but in the query tree we need to switch from the enum type to string.

Ideally we'd be able to simply replace the enum-typed node with an identical string-typed node - but there's no reliable way to change all node types (column, function call...), unless we introduce e.g. an abstract WithType() to SqlExpression.

The alternative way would be to add a special conversion node - which would extend SqlExpression - but to simply skip it in SQL generation. The disadvantage here is that any sort of pattern matching on the node would fail (e.g. is this node a column?).

In the meantime, we'd applying a SQL conversion, which should be a no-op.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant