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

Null semantics applies incorrectly for SqlFunction #16245

Closed
smitpatel opened this issue Jun 25, 2019 · 3 comments
Closed

Null semantics applies incorrectly for SqlFunction #16245

smitpatel opened this issue Jun 25, 2019 · 3 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

Not sure if it would be applicable to more types but we generate this SQL,
Where_string_to_upper

            AssertSql(
                @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
WHERE (UPPER([c].[CustomerID]) = N'ALFKI') AND UPPER([c].[CustomerID]) IS NOT NULL");

[c].[CustomerID] is never null since its PK and metadata is also correctly says that.

Null semantics is ending up with stale value.

Found out when I made totally unrelated change which made value of stale value change and generated correct SQL.

@smitpatel
Copy link
Contributor Author

It does not seem like duplicate. Do you think #16078 would be fixed by doing something unrelated to null semantics?

@maumar
Copy link
Contributor

maumar commented Jun 26, 2019

@smitpatel you are right, its a bug, fix incoming

maumar added a commit that referenced this issue Jun 26, 2019
problem was that when we were computing a nullability of sql function, if the function didn't have instance, we would inherit nullability from the expression that was visited previously.
Fix is to only use nullability of instance expression if that expression is not null.
maumar added a commit that referenced this issue Jun 26, 2019
problem was that when we were computing a nullability of sql function, if the function didn't have instance, we would inherit nullability from the expression that was visited previously.
Fix is to only use nullability of instance expression if that expression is not null.
maumar added a commit that referenced this issue Jun 26, 2019
problem was that when we were computing a nullability of sql function, if the function didn't have instance, we would inherit nullability from the expression that was visited previously.
Fix is to only use nullability of instance expression if that expression is not null.
@ajcvickers ajcvickers added this to the 3.0.0 milestone Jun 28, 2019
smitpatel pushed a commit that referenced this issue Jun 28, 2019
problem was that when we were computing a nullability of sql function, if the function didn't have instance, we would inherit nullability from the expression that was visited previously.
Fix is to only use nullability of instance expression if that expression is not null.
smitpatel pushed a commit that referenced this issue Jun 28, 2019
problem was that when we were computing a nullability of sql function, if the function didn't have instance, we would inherit nullability from the expression that was visited previously.
Fix is to only use nullability of instance expression if that expression is not null.
smitpatel pushed a commit that referenced this issue Jun 28, 2019
problem was that when we were computing a nullability of sql function, if the function didn't have instance, we would inherit nullability from the expression that was visited previously.
Fix is to only use nullability of instance expression if that expression is not null.
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Jun 28, 2019
@smitpatel
Copy link
Contributor Author

Fixed via #16266

@ajcvickers ajcvickers modified the milestones: 3.0.0, 3.0.0-preview7 Jul 2, 2019
@ajcvickers ajcvickers modified the milestones: 3.0.0-preview7, 3.0.0 Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

3 participants