Skip to content

Query: Nullsemantics are not applied to NOT IN (...) #11464

@smitpatel

Description

@smitpatel

Test Accessing_optional_property_inside_result_operator_subquery

            var names = new[] { "Name1", "Name2" };
            AssertQuery<Level1>(
                l1s => l1s.Where(l1 => names.All(n => l1.OneToOne_Optional_FK.Name != n)),
                l1s => l1s.Where(l1 => names.All(n => Maybe(l1.OneToOne_Optional_FK, () => l1.OneToOne_Optional_FK.Name) != n)));

Generated SQL

  SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_InverseId], [l1].[OneToMany_Required_Self_InverseId], [l1].[OneToOne_Optional_SelfId]
  FROM [LevelOne] AS [l1]
  LEFT JOIN [LevelTwo] AS [l1.OneToOne_Optional_FK] ON [l1].[Id] = [l1.OneToOne_Optional_FK].[Level1_Optional_Id]
  WHERE [l1.OneToOne_Optional_FK].[Name] NOT IN (N'Name1', N'Name2')

But [l1.OneToOne_Optional_FK].[Name] is nullable so we need to append OR [l1.OneToOne_Optional_FK].[Name] IS NULL

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions