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 set operations for columns that map to same store type #30400

Closed
wants to merge 1 commit into from

Conversation

ajcvickers
Copy link
Member

Fixes #29020

@ajcvickers ajcvickers requested a review from a team March 3, 2023 19:34
/// </summary>
/// <param name="otherMapping">The other type mapping.</param>
/// <returns><see langword="true"/> if the two mappings map to the same type, <see langword="false"/> otherwise.</returns>
public virtual bool MapsToSameStoreType(CoreTypeMapping otherMapping)
Copy link
Member

Choose a reason for hiding this comment

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

Should this only compare the actual (string) store type name into account? There could be different mappings - including even with different CLR types - which map to the same store type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Example?

Copy link
Member Author

Choose a reason for hiding this comment

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

Never mind; I think you are right. Will re-work this. Was trying to be too clever. Always best not to try to be clever.

@stevendarby
Copy link
Contributor

stevendarby commented Mar 10, 2023

Why not just never throw that InvalidOperationException? If it proceeds and the query fails on the server because the store types aren't compatible then the user is in the same position: the query doesn't work. Currently this seems to be what is preventing set operations between, say, nvarchar(10) and nvarchar(20), which SQL Server is fine with.

@ajcvickers
Copy link
Member Author

@roji @stevendarby Discussion is here: #16813 (comment)

I'd be okay with removing this check entirely.

@roji
Copy link
Member

roji commented Mar 13, 2023

Thanks for finding that discussion @ajcvickers. I'm also OK with removing the check.

@stevendarby
Copy link
Contributor

@ajcvickers @roji Ah cool! I think that would close #19129

@ajcvickers
Copy link
Member Author

Decision from design meeting: stop throwing in this case and let the database throw if the types are not compatible.

@ajcvickers ajcvickers closed this Mar 13, 2023
@NetMage
Copy link

NetMage commented Mar 29, 2023

Is there a way to tell when this will be released (included in what version)?

@ajcvickers
Copy link
Member Author

@NetMage This PR is closed without being merged. We decided not to do this.

@NetMage
Copy link

NetMage commented Mar 30, 2023

@ajcvickers Thank you, I was referring to the design meeting decision to stop throwing in this case. I assume a new PR will have to be created to implement that decision, but the corresponding issues seem to have been closed based on this PR?

@ajcvickers
Copy link
Member Author

#30468

@ajcvickers ajcvickers deleted the ItQuacksLikeADuck0303 branch November 30, 2023 14:06
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.

SQL Server: Set operations should work if normalized store type is the same
4 participants