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

Do not generate Convert node in SQL if the converted store type is identical to the operand's #26411

Open
roji opened this issue Oct 20, 2021 · 3 comments
Assignees
Labels
area-query punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Oct 20, 2021

There are sometimes scenarios where multiple CLR types can be mapped to the same store type (e.g. PostgreSQL maps Instant, DateTime (with kind UTC), ZonedDateTime (with timezone UTC) and OffsetDateTime (with offset 0) to timestamp with time zone; all represent UTC timestamps).

These types contain various conversion methods between one another (e.g. Instant.ToDateTimeUtc returns a UTC DateTime). When translating these, a Convert node is needed to have the correct CLR type, but nothing needs to actually happen in SQL since at the database side it's the same type.

When generating SQL for Convert, we could simply avoid the conversion if the node and the operand node's type mappings' store types are the same.

/cc @smitpatel

@smitpatel
Copy link
Member

related #15586

@roji
Copy link
Member Author

roji commented Oct 20, 2021

Yeah.

Also, doing this could cause problems for me until #19503 is fixed - I use "redundant" convert nodes to force the store type on parameters in some cases because of it (PG citext).

@roji roji closed this as completed Oct 20, 2021
@roji roji reopened this Oct 20, 2021
@ajcvickers ajcvickers added this to the Backlog milestone Oct 22, 2021
@ajcvickers ajcvickers modified the milestones: Backlog, 7.0.0 Oct 22, 2021
@ajcvickers ajcvickers added punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. and removed propose-punt labels Apr 23, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Apr 23, 2022
@roji
Copy link
Member Author

roji commented Aug 31, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Projects
None yet
Development

No branches or pull requests

3 participants