diff --git a/Access.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.LinqService).sql b/Access.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.LinqService).sql index 0e9a61f03dc..81b9dff6a05 100644 --- a/Access.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.LinqService).sql @@ -2,35 +2,44 @@ -- Access AccessOleDb SELECT - [c_1].[ParentID], - [c_1].[ChildID] + IIF([t1].[ParentID_1] IS NULL, 0, [t1].[ParentID_1]), + ( + SELECT TOP 1 + [c_2].[ParentID] + FROM + [Child] [c_2] + WHERE + [c_2].[ChildID] > -100 + ORDER BY + [c_2].[ParentID] + ), + ( + SELECT TOP 1 + [c_3].[ChildID] + FROM + [Child] [c_3] + WHERE + [c_3].[ChildID] > -100 + ORDER BY + [c_3].[ParentID] + ) FROM - [Child] [c_1] -WHERE - [c_1].[ParentID] > 0 + ( + SELECT + [p].[ParentID], + ( + SELECT TOP 1 + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [c_1].[ParentID] - -BeforeExecute --- Access AccessOleDb - -SELECT - [c_1].[ParentID], - [c_1].[ChildID] -FROM - [Child] [c_1] -WHERE - [c_1].[ChildID] > -100 -ORDER BY - [c_1].[ParentID] - -BeforeExecute --- Access AccessOleDb - -SELECT - 1 -FROM - [Parent] [p] -ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/Access.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.LinqService).sql b/Access.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.LinqService).sql index ab6e180a155..70a36dc1bb0 100644 --- a/Access.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/Access.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.LinqService).sql b/Access.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.LinqService).sql index 48efe9243b9..ef953ab5b76 100644 --- a/Access.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,14).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,14).sql index 8696db1561f..5c3fdcf60ef 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,14).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,15).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,15).sql index b2ee9105cb9..882025b26e5 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,15).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,14).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,14).sql index 1b613df9d7c..83185dca786 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,14).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,15).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,15).sql index c434e264545..07af5f96249 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,15).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,14).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,14).sql index 35aefb77667..30ef5f17742 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,14).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,15).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,15).sql index d7a0d4acb6a..83b9723ff51 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,15).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,14).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,14).sql index 7c64a9d4599..2427e8fb511 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,14).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,15).sql b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,15).sql index a4f9a7b7105..78b9b65b43a 100644 --- a/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,15).sql +++ b/Access.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.LinqService).sql b/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.LinqService).sql index aeaa4581a25..58901ecef77 100644 --- a/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.LinqService).sql @@ -2,10 +2,10 @@ -- Access AccessOleDb SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -13,7 +13,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.LinqService).sql b/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.LinqService).sql index a061c7934eb..6624fd14a33 100644 --- a/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -15,7 +15,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -23,7 +23,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.LinqService).sql b/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.LinqService).sql index 2ef6a23c61d..e23831b5388 100644 --- a/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1_1 Integer -- Int32 SET @id1_1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN [Parent] [left2] ON ([left_1].[Value1] = [left2].[Value1] + 2) WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -29,7 +29,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1_1 - ) [right_2] ON (([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.LinqService).sql index 07d7ce032b4..ec0c1c9e7aa 100644 --- a/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.LinqService).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access AccessOleDb SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) BeforeExecute -- Access AccessOleDb @@ -516,13 +516,13 @@ BeforeExecute -- Access AccessOleDb SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC BeforeExecute -- Access AccessOleDb diff --git a/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.LinqService).sql index af38d9c634a..df6d008fc1b 100644 --- a/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.LinqService).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access AccessOleDb SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] MOD 3) + MAX([x].[OrderData1] MOD 3) BeforeExecute -- Access AccessOleDb diff --git a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.LinqService).sql index d766873cd43..5e111f8cae3 100644 --- a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.LinqService).sql @@ -2,11 +2,11 @@ -- Access AccessOleDb SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2, + [ch].[ChildID] DESC diff --git a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.LinqService).sql index aa101f1b933..ae7196464e6 100644 --- a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] MOD 2 diff --git a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.LinqService).sql index aa101f1b933..6667c99af2d 100644 --- a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.LinqService).sql @@ -2,11 +2,11 @@ -- Access AccessOleDb SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [ch].[ChildID] MOD 2, + [ch].[ChildID] diff --git a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.LinqService).sql index cc49c30e05b..62527bf28a8 100644 --- a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.LinqService).sql @@ -2,11 +2,11 @@ -- Access AccessOleDb SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2 DESC, + [ch].[ChildID] DESC diff --git a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.LinqService).sql b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.LinqService).sql index 616c5638cd5..214fbbdb68c 100644 --- a/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.LinqService).sql @@ -2,11 +2,18 @@ -- Access AccessOleDb SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), True, False) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[flag] diff --git a/Access.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.LinqService).sql b/Access.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.LinqService).sql new file mode 100644 index 00000000000..4523a1ddfa2 --- /dev/null +++ b/Access.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- Access AccessOleDb + +DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- Access AccessOleDb + +CREATE TABLE [CoalesceNullableFields] +( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb + +SELECT + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable2]), [t].[Nullable1]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable1]), [t].[Nullable2]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable3]), [t].[Nullable2]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]), [t].[Nullable3]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable2]), [t].[Nullable3]), + [t].[Id], + IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- Access AccessOleDb + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- Access AccessOleDb + +DROP TABLE [CoalesceNullableFields] + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.LinqService).sql new file mode 100644 index 00000000000..a85189dfdd5 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND ([p].[MiddleName] IS NULL OR [p].[MiddleName] = 'None' AND [p].[MiddleName] IS NOT NULL) AND + [p].[FirstName] = 'John' + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.LinqService).sql new file mode 100644 index 00000000000..bef72b9aa96 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.LinqService).sql index 37c7d7e1e73..bef72b9aa96 100644 --- a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.LinqService).sql @@ -2,17 +2,10 @@ -- Access AccessOleDb SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.LinqService).sql index f60fdd5b1a6..0df263876b0 100644 --- a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.LinqService).sql +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.LinqService).sql @@ -2,14 +2,10 @@ -- Access AccessOleDb SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.LinqService).sql new file mode 100644 index 00000000000..98debec2592 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.LinqService).sql new file mode 100644 index 00000000000..305be25f914 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.LinqService).sql new file mode 100644 index 00000000000..0df263876b0 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.LinqService).sql new file mode 100644 index 00000000000..c5c75373c05 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.LinqService).sql new file mode 100644 index 00000000000..37c7d7e1e73 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.LinqService).sql b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.LinqService).sql new file mode 100644 index 00000000000..f60fdd5b1a6 --- /dev/null +++ b/Access.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/Access.Odbc.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc.LinqService).sql index c8fb27cc9e5..c2e367ee1b0 100644 --- a/Access.Odbc.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc.LinqService).sql @@ -2,35 +2,44 @@ -- Access.Odbc AccessODBC SELECT - [c_1].[ParentID], - [c_1].[ChildID] + IIF([t1].[ParentID_1] IS NULL, 0, [t1].[ParentID_1]), + ( + SELECT TOP 1 + [c_2].[ParentID] + FROM + [Child] [c_2] + WHERE + [c_2].[ChildID] > -100 + ORDER BY + [c_2].[ParentID] + ), + ( + SELECT TOP 1 + [c_3].[ChildID] + FROM + [Child] [c_3] + WHERE + [c_3].[ChildID] > -100 + ORDER BY + [c_3].[ParentID] + ) FROM - [Child] [c_1] -WHERE - [c_1].[ParentID] > 0 + ( + SELECT + [p].[ParentID], + ( + SELECT TOP 1 + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [c_1].[ParentID] - -BeforeExecute --- Access.Odbc AccessODBC - -SELECT - [c_1].[ParentID], - [c_1].[ChildID] -FROM - [Child] [c_1] -WHERE - [c_1].[ChildID] > -100 -ORDER BY - [c_1].[ParentID] - -BeforeExecute --- Access.Odbc AccessODBC - -SELECT - 1 -FROM - [Parent] [p] -ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc.LinqService).sql index 43d1ec09aea..b0666fa0db7 100644 --- a/Access.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/Access.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc.LinqService).sql index 8877c9af1a5..62df26d113a 100644 --- a/Access.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,14).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,14).sql index 94645b69210..56042d3dc41 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,14).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,15).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,15).sql index d4923aea2d4..ca3db206992 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,15).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,14).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,14).sql index 94645b69210..56042d3dc41 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,14).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,15).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,15).sql index d4923aea2d4..ca3db206992 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,15).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,14).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,14).sql index 53adf93a90d..fbb6dbfe3e8 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,14).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,15).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,15).sql index 793c574c83d..7d04427c64e 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,15).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,14).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,14).sql index 8417d5b87e9..7d7597470b5 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,14).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,15).sql b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,15).sql index 68eae319450..cfc41213d38 100644 --- a/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,15).sql +++ b/Access.Odbc.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc.LinqService).sql index 3259592a5df..cde6594b607 100644 --- a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -19,7 +19,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> ? - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -29,7 +29,7 @@ FROM INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) WHERE [right_1].[ParentID] <> ? AND [right2].[ParentID] <> ? - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc.LinqService).sql index 8b676f5366d..9fb9a6df47a 100644 --- a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc.LinqService).sql @@ -2,10 +2,10 @@ -- Access.Odbc AccessODBC SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -13,7 +13,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc.LinqService).sql index d92ed5e7be8..1eafc524908 100644 --- a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -15,7 +15,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> ? - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -23,7 +23,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc.LinqService).sql index 4dad74f3b50..e8a81fa31a4 100644 --- a/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN [Parent] [left2] ON ([left_1].[Value1] = [left2].[Value1] + 2) WHERE [left_1].[ParentID] <> ? AND [left2].[ParentID] <> ? - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -29,7 +29,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> ? - ) [right_2] ON (([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc.LinqService).sql index fb2e1b486b5..161914cf1d8 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc.LinqService).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access.Odbc AccessODBC SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) BeforeExecute -- Access.Odbc AccessODBC @@ -516,13 +516,13 @@ BeforeExecute -- Access.Odbc AccessODBC SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC BeforeExecute -- Access.Odbc AccessODBC diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc.LinqService).sql index 2247318f882..b250bbb62e6 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc.LinqService).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access.Odbc AccessODBC SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] MOD 3) + MAX([x].[OrderData1] MOD 3) BeforeExecute -- Access.Odbc AccessODBC diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc.LinqService).sql index 171e0bc1f96..c04f9e1b062 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc.LinqService).sql @@ -2,11 +2,11 @@ -- Access.Odbc AccessODBC SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2, + [ch].[ChildID] DESC diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc.LinqService).sql index 1261a6438f8..426c5955749 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] MOD 2 diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc.LinqService).sql index 1261a6438f8..7fcc3e4d4ac 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc.LinqService).sql @@ -2,11 +2,11 @@ -- Access.Odbc AccessODBC SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [ch].[ChildID] MOD 2, + [ch].[ChildID] diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc.LinqService).sql index 17629ca9797..022f89668a4 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc.LinqService).sql @@ -2,11 +2,11 @@ -- Access.Odbc AccessODBC SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2 DESC, + [ch].[ChildID] DESC diff --git a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc.LinqService).sql index e404ccd510a..068321af5de 100644 --- a/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc.LinqService).sql @@ -2,11 +2,18 @@ -- Access.Odbc AccessODBC SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), True, False) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[flag] diff --git a/Access.Odbc.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..675b117a9e5 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.Odbc.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- Access.Odbc AccessODBC + +CREATE TABLE [CoalesceNullableFields] +( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable2]), [t].[Nullable1]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable1]), [t].[Nullable2]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable3]), [t].[Nullable2]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]), [t].[Nullable3]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable2]), [t].[Nullable3]), + [t].[Id], + IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- Access.Odbc AccessODBC + +DROP TABLE [CoalesceNullableFields] + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..583398d19bb --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.Odbc.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND ([p].[MiddleName] IS NULL OR [p].[MiddleName] = 'None' AND [p].[MiddleName] IS NOT NULL) AND + [p].[FirstName] = 'John' + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..1d938e86523 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc.LinqService).sql index a5b74e65354..1d938e86523 100644 --- a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc.LinqService).sql @@ -2,17 +2,10 @@ -- Access.Odbc AccessODBC SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc.LinqService).sql index 0054ecba3cc..9ab6c0fe778 100644 --- a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc.LinqService).sql +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc.LinqService).sql @@ -2,14 +2,10 @@ -- Access.Odbc AccessODBC SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..e16a34a2e25 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..8d4ebf72224 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..9ab6c0fe778 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..dffe0081e25 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.Odbc.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..a5b74e65354 --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.Odbc.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.Odbc.LinqService).sql b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.Odbc.LinqService).sql new file mode 100644 index 00000000000..0054ecba3cc --- /dev/null +++ b/Access.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.Odbc.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/Access.Odbc/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc).sql b/Access.Odbc/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc).sql index 75ce59958bc..c2e367ee1b0 100644 --- a/Access.Odbc/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access.Odbc).sql @@ -1,40 +1,45 @@ BeforeExecute -BeginTransaction(Unspecified) -BeforeExecute -- Access.Odbc AccessODBC SELECT - [c_1].[ParentID], - [c_1].[ChildID] + IIF([t1].[ParentID_1] IS NULL, 0, [t1].[ParentID_1]), + ( + SELECT TOP 1 + [c_2].[ParentID] + FROM + [Child] [c_2] + WHERE + [c_2].[ChildID] > -100 + ORDER BY + [c_2].[ParentID] + ), + ( + SELECT TOP 1 + [c_3].[ChildID] + FROM + [Child] [c_3] + WHERE + [c_3].[ChildID] > -100 + ORDER BY + [c_3].[ParentID] + ) FROM - [Child] [c_1] -WHERE - [c_1].[ParentID] > 0 + ( + SELECT + [p].[ParentID], + ( + SELECT TOP 1 + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [c_1].[ParentID] - -BeforeExecute --- Access.Odbc AccessODBC - -SELECT - [c_1].[ParentID], - [c_1].[ChildID] -FROM - [Child] [c_1] -WHERE - [c_1].[ChildID] > -100 -ORDER BY - [c_1].[ParentID] - -BeforeExecute -DisposeTransaction -BeforeExecute --- Access.Odbc AccessODBC - -SELECT - 1 -FROM - [Parent] [p] -ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc).sql b/Access.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc).sql index cd381044c44..4611c1d4ba4 100644 --- a/Access.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access.Odbc).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/Access.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc).sql b/Access.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc).sql index 8877c9af1a5..62df26d113a 100644 --- a/Access.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access.Odbc).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,14).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,14).sql index 94645b69210..56042d3dc41 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,14).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,15).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,15).sql index d4923aea2d4..ca3db206992 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,15).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access.Odbc,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,14).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,14).sql index 94645b69210..56042d3dc41 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,14).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,15).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,15).sql index d4923aea2d4..ca3db206992 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,15).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access.Odbc,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,14).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,14).sql index 53adf93a90d..fbb6dbfe3e8 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,14).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,15).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,15).sql index 793c574c83d..7d04427c64e 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,15).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access.Odbc,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,14).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,14).sql index 8417d5b87e9..7d7597470b5 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,14).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,15).sql b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,15).sql index 68eae319450..cfc41213d38 100644 --- a/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,15).sql +++ b/Access.Odbc/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access.Odbc,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= ? and [id] < ? - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access.Odbc/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access.Odbc).sql b/Access.Odbc/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access.Odbc).sql index b6e27bf03b1..c1588a9ef29 100644 --- a/Access.Odbc/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access.Odbc).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = 'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON ([y_1].[PersonID] = [person_1].[PersonID]) + ) [t1] + INNER JOIN [Person] [person_1] ON ([t1].[PersonID] = [person_1].[PersonID]) ORDER BY [person_1].[PersonID] diff --git a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc).sql b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc).sql index 3259592a5df..cde6594b607 100644 --- a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Access.Odbc).sql @@ -8,7 +8,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -19,7 +19,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> ? - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -29,7 +29,7 @@ FROM INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) WHERE [right_1].[ParentID] <> ? AND [right2].[ParentID] <> ? - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc).sql b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc).sql index 8b676f5366d..9fb9a6df47a 100644 --- a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access.Odbc).sql @@ -2,10 +2,10 @@ -- Access.Odbc AccessODBC SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -13,7 +13,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc).sql b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc).sql index d92ed5e7be8..1eafc524908 100644 --- a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access.Odbc).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -15,7 +15,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> ? - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -23,7 +23,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc).sql b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc).sql index 4dad74f3b50..e8a81fa31a4 100644 --- a/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access.Odbc).sql @@ -8,7 +8,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN [Parent] [left2] ON ([left_1].[Value1] = [left2].[Value1] + 2) WHERE [left_1].[ParentID] <> ? AND [left2].[ParentID] <> ? - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -29,7 +29,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> ? - ) [right_2] ON (([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc).sql index fb2e1b486b5..161914cf1d8 100644 --- a/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access.Odbc).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access.Odbc AccessODBC SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) BeforeExecute -- Access.Odbc AccessODBC @@ -516,13 +516,13 @@ BeforeExecute -- Access.Odbc AccessODBC SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC BeforeExecute -- Access.Odbc AccessODBC diff --git a/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc).sql index 2247318f882..b250bbb62e6 100644 --- a/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access.Odbc).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access.Odbc AccessODBC SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] MOD 3) + MAX([x].[OrderData1] MOD 3) BeforeExecute -- Access.Odbc AccessODBC diff --git a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc).sql index 171e0bc1f96..c04f9e1b062 100644 --- a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access.Odbc).sql @@ -2,11 +2,11 @@ -- Access.Odbc AccessODBC SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2, + [ch].[ChildID] DESC diff --git a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc).sql index 1261a6438f8..426c5955749 100644 --- a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access.Odbc).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] MOD 2 diff --git a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc).sql index 1261a6438f8..7fcc3e4d4ac 100644 --- a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access.Odbc).sql @@ -2,11 +2,11 @@ -- Access.Odbc AccessODBC SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [ch].[ChildID] MOD 2, + [ch].[ChildID] diff --git a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc).sql index 17629ca9797..022f89668a4 100644 --- a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access.Odbc).sql @@ -2,11 +2,11 @@ -- Access.Odbc AccessODBC SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2 DESC, + [ch].[ChildID] DESC diff --git a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc).sql b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc).sql index e404ccd510a..068321af5de 100644 --- a/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access.Odbc).sql @@ -2,11 +2,18 @@ -- Access.Odbc AccessODBC SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), True, False) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[flag] diff --git a/Access.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.Odbc).sql b/Access.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.Odbc).sql new file mode 100644 index 00000000000..675b117a9e5 --- /dev/null +++ b/Access.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access.Odbc).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- Access.Odbc AccessODBC + +CREATE TABLE [CoalesceNullableFields] +( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable2]), [t].[Nullable1]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable1]), [t].[Nullable2]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable3]), [t].[Nullable2]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]), [t].[Nullable3]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable2]), [t].[Nullable3]), + [t].[Id], + IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- Access.Odbc AccessODBC + +DROP TABLE [CoalesceNullableFields] + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.Odbc).sql new file mode 100644 index 00000000000..583398d19bb --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access.Odbc).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND ([p].[MiddleName] IS NULL OR [p].[MiddleName] = 'None' AND [p].[MiddleName] IS NOT NULL) AND + [p].[FirstName] = 'John' + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.Odbc).sql new file mode 100644 index 00000000000..1d938e86523 --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc).sql index a5b74e65354..1d938e86523 100644 --- a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access.Odbc).sql @@ -2,17 +2,10 @@ -- Access.Odbc AccessODBC SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc).sql index 0054ecba3cc..9ab6c0fe778 100644 --- a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc).sql +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access.Odbc).sql @@ -2,14 +2,10 @@ -- Access.Odbc AccessODBC SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.Odbc).sql new file mode 100644 index 00000000000..e16a34a2e25 --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.Odbc).sql new file mode 100644 index 00000000000..8d4ebf72224 --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.Odbc).sql new file mode 100644 index 00000000000..9ab6c0fe778 --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.Odbc).sql new file mode 100644 index 00000000000..dffe0081e25 --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access.Odbc).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.Odbc).sql new file mode 100644 index 00000000000..a5b74e65354 --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access.Odbc).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.Odbc).sql b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.Odbc).sql new file mode 100644 index 00000000000..0054ecba3cc --- /dev/null +++ b/Access.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access.Odbc).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access.Odbc AccessODBC + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/Access/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access).sql b/Access/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access).sql index 5da9a594adb..81b9dff6a05 100644 --- a/Access/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access).sql +++ b/Access/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Access).sql @@ -1,40 +1,45 @@ BeforeExecute -BeginTransaction(Unspecified) -BeforeExecute -- Access AccessOleDb SELECT - [c_1].[ParentID], - [c_1].[ChildID] + IIF([t1].[ParentID_1] IS NULL, 0, [t1].[ParentID_1]), + ( + SELECT TOP 1 + [c_2].[ParentID] + FROM + [Child] [c_2] + WHERE + [c_2].[ChildID] > -100 + ORDER BY + [c_2].[ParentID] + ), + ( + SELECT TOP 1 + [c_3].[ChildID] + FROM + [Child] [c_3] + WHERE + [c_3].[ChildID] > -100 + ORDER BY + [c_3].[ParentID] + ) FROM - [Child] [c_1] -WHERE - [c_1].[ParentID] > 0 + ( + SELECT + [p].[ParentID], + ( + SELECT TOP 1 + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [c_1].[ParentID] - -BeforeExecute --- Access AccessOleDb - -SELECT - [c_1].[ParentID], - [c_1].[ChildID] -FROM - [Child] [c_1] -WHERE - [c_1].[ChildID] > -100 -ORDER BY - [c_1].[ParentID] - -BeforeExecute -DisposeTransaction -BeforeExecute --- Access AccessOleDb - -SELECT - 1 -FROM - [Parent] [p] -ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/Access/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access).sql b/Access/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access).sql index 513f2dabe9b..4d7abd74b26 100644 --- a/Access/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access).sql +++ b/Access/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Access).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/Access/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access).sql b/Access/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access).sql index 48efe9243b9..ef953ab5b76 100644 --- a/Access/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access).sql +++ b/Access/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Access).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,14).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,14).sql index 8696db1561f..5c3fdcf60ef 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,14).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,15).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,15).sql index b2ee9105cb9..882025b26e5 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,15).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Access,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,14).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,14).sql index 1b613df9d7c..83185dca786 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,14).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,15).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,15).sql index c434e264545..07af5f96249 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,15).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Access,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,14).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,14).sql index 35aefb77667..30ef5f17742 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,14).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,15).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,15).sql index d7a0d4acb6a..83b9723ff51 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,15).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Access,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,14).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,14).sql index 7c64a9d4599..2427e8fb511 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,14).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,15).sql b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,15).sql index a4f9a7b7105..78b9b65b43a 100644 --- a/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,15).sql +++ b/Access/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Access,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON ([s].[id] = [c_1].[id]) + ) [s] ON ([s].[id] = [t1].[id]) WHERE [s].[id] > 10 ORDER BY diff --git a/Access/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access).sql b/Access/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access).sql index f9200068147..f9905609dfe 100644 --- a/Access/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access).sql +++ b/Access/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(Access).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = 'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON ([y_1].[PersonID] = [person_1].[PersonID]) + ) [t1] + INNER JOIN [Person] [person_1] ON ([t1].[PersonID] = [person_1].[PersonID]) ORDER BY [person_1].[PersonID] diff --git a/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access).sql b/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access).sql index aeaa4581a25..58901ecef77 100644 --- a/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access).sql +++ b/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Access).sql @@ -2,10 +2,10 @@ -- Access AccessOleDb SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -13,7 +13,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access).sql b/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access).sql index a061c7934eb..6624fd14a33 100644 --- a/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access).sql +++ b/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Access).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -15,7 +15,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -23,7 +23,7 @@ FROM FROM [Parent] [right_1] INNER JOIN [Parent] [right2] ON ([right_1].[Value1] = [right2].[Value1] + 2) - ) [right_2] ON (([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access).sql b/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access).sql index 2ef6a23c61d..e23831b5388 100644 --- a/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access).sql +++ b/Access/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Access).sql @@ -8,7 +8,7 @@ DECLARE @id1_1 Integer -- Int32 SET @id1_1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN [Parent] [left2] ON ([left_1].[Value1] = [left2].[Value1] + 2) WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -29,7 +29,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1_1 - ) [right_2] ON (([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL)) + ) [right_2] ON (([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL)) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access).sql b/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access).sql index 07d7ce032b4..ec0c1c9e7aa 100644 --- a/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access).sql +++ b/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Access).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access AccessOleDb SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) BeforeExecute -- Access AccessOleDb @@ -516,13 +516,13 @@ BeforeExecute -- Access AccessOleDb SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC BeforeExecute -- Access AccessOleDb diff --git a/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access).sql b/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access).sql index af38d9c634a..df6d008fc1b 100644 --- a/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access).sql +++ b/Access/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Access).sql @@ -496,13 +496,13 @@ BeforeExecute -- Access AccessOleDb SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] MOD 3) + MAX([x].[OrderData1] MOD 3) BeforeExecute -- Access AccessOleDb diff --git a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access).sql b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access).sql index d766873cd43..5e111f8cae3 100644 --- a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access).sql +++ b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Access).sql @@ -2,11 +2,11 @@ -- Access AccessOleDb SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2, + [ch].[ChildID] DESC diff --git a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access).sql b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access).sql index aa101f1b933..ae7196464e6 100644 --- a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access).sql +++ b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Access).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] MOD 2 diff --git a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access).sql b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access).sql index aa101f1b933..6667c99af2d 100644 --- a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access).sql +++ b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Access).sql @@ -2,11 +2,11 @@ -- Access AccessOleDb SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2, - [x].[ChildID] + [ch].[ChildID] MOD 2, + [ch].[ChildID] diff --git a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access).sql b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access).sql index cc49c30e05b..62527bf28a8 100644 --- a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access).sql +++ b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Access).sql @@ -2,11 +2,11 @@ -- Access AccessOleDb SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] MOD 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] MOD 2 DESC, + [ch].[ChildID] DESC diff --git a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access).sql b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access).sql index 616c5638cd5..214fbbdb68c 100644 --- a/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access).sql +++ b/Access/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Access).sql @@ -2,11 +2,18 @@ -- Access AccessOleDb SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), True, False) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), True, False) + [t2].[flag] diff --git a/Access/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access).sql b/Access/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access).sql new file mode 100644 index 00000000000..4523a1ddfa2 --- /dev/null +++ b/Access/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Access).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- Access AccessOleDb + +DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- Access AccessOleDb + +CREATE TABLE [CoalesceNullableFields] +( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Access AccessOleDb + +SELECT + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable2]), [t].[Nullable1]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable3] IS NULL, [t].[Id], [t].[Nullable3]), [t].[Nullable1]), [t].[Nullable2]), + IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable3]), [t].[Nullable2]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]), [t].[Nullable3]), + IIF([t].[Nullable3] IS NULL, IIF([t].[Nullable2] IS NULL, IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), [t].[Nullable2]), [t].[Nullable3]), + [t].[Id], + IIF([t].[Nullable1] IS NULL, [t].[Id], [t].[Nullable1]), + IIF([t].[Nullable1] IS NULL, IIF([t].[Nullable2] IS NULL, [t].[Id], [t].[Nullable2]), [t].[Nullable1]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- Access AccessOleDb + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- Access AccessOleDb + +DROP TABLE [CoalesceNullableFields] + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access).sql new file mode 100644 index 00000000000..a85189dfdd5 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Access).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND ([p].[MiddleName] IS NULL OR [p].[MiddleName] = 'None' AND [p].[MiddleName] IS NOT NULL) AND + [p].[FirstName] = 'John' + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access).sql new file mode 100644 index 00000000000..bef72b9aa96 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Access).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access).sql index 37c7d7e1e73..bef72b9aa96 100644 --- a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access).sql +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Access).sql @@ -2,17 +2,10 @@ -- Access AccessOleDb SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access).sql index f60fdd5b1a6..0df263876b0 100644 --- a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access).sql +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Access).sql @@ -2,14 +2,10 @@ -- Access AccessOleDb SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access).sql new file mode 100644 index 00000000000..98debec2592 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Access).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access).sql new file mode 100644 index 00000000000..305be25f914 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Access).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access).sql new file mode 100644 index 00000000000..0df263876b0 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Access).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access).sql new file mode 100644 index 00000000000..c5c75373c05 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Access).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access).sql new file mode 100644 index 00000000000..37c7d7e1e73 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Access).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access).sql b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access).sql new file mode 100644 index 00000000000..f60fdd5b1a6 --- /dev/null +++ b/Access/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Access).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Access AccessOleDb + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client.LinqService).sql index 6babb530323..52a6793199e 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) + WHEN t1.ParentID_1 IS NULL THEN 0 + ELSE t1.ParentID_1 END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - Parent p + ( + SELECT + p.ParentID as ParentID, + ( + SELECT + c_1.ParentID + FROM + Child c_1 + WHERE + c_1.ParentID > 0 + ORDER BY + c_1.ParentID + LIMIT 1 + ) as ParentID_1 + FROM + Parent p + ) t1 ORDER BY - p.ParentID + t1.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client.LinqService,False).sql b/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client.LinqService,False).sql index 04bffdfce21..337203dd7cb 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client.LinqService,False).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client.LinqService,False).sql @@ -85,22 +85,24 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue FROM - Issue4167Table g_1 -WHERE - g_1.Value = '000001' -GROUP BY - g_1.Value, - g_1.EnumValue + ( + SELECT + CASE + WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue + ELSE 0 + END as EnumValue + FROM + Issue4167Table g_1 + WHERE + g_1.Value = '000001' + GROUP BY + g_1.Value, + g_1.EnumValue + ) t1 ORDER BY - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client.LinqService).sql index 357ad2a7685..a204f48a3b1 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client.LinqService).sql @@ -66,10 +66,10 @@ SELECT c4.ChildID, c4.ParentID FROM - Child p - INNER JOIN Child c4 ON c4.ParentID = p.ParentID + Child c_1 + INNER JOIN Child c4 ON c4.ParentID = c_1.ParentID WHERE - p.ParentID > 1 AND c4.ParentID % 2 = 0 + c_1.ParentID > 1 AND c4.ParentID % 2 = 0 ORDER BY c4.ChildID, c4.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client.LinqService).sql index 0594fa4876a..6f58ebe527b 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addDays(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client.LinqService).sql index f809b4fcad2..aac13d7c8c7 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addHours(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client.LinqService).sql index 63884c9d51f..79a4d3d14c6 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM fromUnixTimestamp64Nano(toUnixTimestamp64Nano(x.TransactionDate) + toInt64(toFloat64(-1000000))) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client.LinqService).sql index fcb8cf6c044..8500ec40446 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addMinutes(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client.LinqService).sql index bf6abbb6a0c..f702a619208 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addMonths(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client.LinqService).sql index d740964d87f..8d0e9e0df0d 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addSeconds(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client.LinqService).sql index 80d71e7e536..cddc4304015 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addYears(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client.LinqService).sql index 964ebebe466..89cac07c0e8 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDate32(x.TransactionDate) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client.LinqService).sql index efd8b9f7961..c3d2adc9883 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.DayOfWeek, + t1.DayOfWeek, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfWeek(addDays(x.TransactionDate, 1)) - 1 as DayOfWeek FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfWeek + t1.DayOfWeek ORDER BY - x_1.DayOfWeek + t1.DayOfWeek BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client.LinqService).sql index 9fd1740c692..5d0037d18f0 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.DayOfYear, + t1.DayOfYear, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfYear(x.TransactionDate) as DayOfYear FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfYear + t1.DayOfYear ORDER BY - x_1.DayOfYear + t1.DayOfYear BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client.LinqService).sql index 0cd8b8ca118..800991bf91a 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Day_1, + t1.Day_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfMonth(x.TransactionDate) as Day_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Day_1 + t1.Day_1 ORDER BY - x_1.Day_1 + t1.Day_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client.LinqService).sql index a62c3f0aedc..1ee415f26ba 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Hour_1, + t1.Hour_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toHour(x.TransactionDate) as Hour_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Hour_1 + t1.Hour_1 ORDER BY - x_1.Hour_1 + t1.Hour_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client.LinqService).sql index 30408f8a1e3..fd2f9365f55 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Millisecond, + t1.Millisecond, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toUnixTimestamp64Milli(x.TransactionDate) % 1000 as Millisecond FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Millisecond + t1.Millisecond ORDER BY - x_1.Millisecond + t1.Millisecond BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client.LinqService).sql index 0e2ade842db..aca34152e76 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Minute_1, + t1.Minute_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toMinute(x.TransactionDate) as Minute_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Minute_1 + t1.Minute_1 ORDER BY - x_1.Minute_1 + t1.Minute_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client.LinqService).sql index 3b39d47e892..e7bd516f3e7 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Month_1, + t1.Month_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toMonth(x.TransactionDate) as Month_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Month_1 + t1.Month_1 ORDER BY - x_1.Month_1 + t1.Month_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client.LinqService).sql index dbf8a10898d..022794a3485 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Second_1, + t1.Second_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toSecond(x.TransactionDate) as Second_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Second_1 + t1.Second_1 ORDER BY - x_1.Second_1 + t1.Second_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client.LinqService).sql index 503c2f452e1..86f26391de1 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toInt64((toUnixTimestamp64Nano(toDateTime64(x.TransactionDate, 7)) - toUnixTimestamp64Nano(toDateTime64(toDate32(x.TransactionDate), 7))) / 100) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client.LinqService).sql index ca87be9cdf1..3e11af91cd0 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Year_1, + t1.Year_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toYear(x.TransactionDate) as Year_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Year_1 + t1.Year_1 ORDER BY - x_1.Year_1 + t1.Year_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client.LinqService).sql index 8b7afd5e0dd..84cd982a4e1 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client.LinqService).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d.ParentID as ParentID, - d.ChildID as ChildID + d.ChildID as ChildID, + d.ParentID as ParentID FROM Child d WHERE diff --git a/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,1).sql b/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,1).sql index ba667768f35..57dcd6716d7 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,1).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,1).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 2 AS PersonID UNION ALL - SELECT 'Doe', 3) n ON p.PersonID = n.PersonID + SELECT 'Doe', 3) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,2).sql b/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,2).sql index 4a69b993515..d6c838e94c6 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,2).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client.LinqService,2).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 3 AS PersonID UNION ALL - SELECT 'Doe', 4) n ON p.PersonID = n.PersonID + SELECT 'Doe', 4) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client.LinqService).sql index 84d4c5f7757..8f735b2cc72 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - concat(t1.FirstName, ' ', t1.LastName) + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,14).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,14).sql index f3544e9137a..9f5aefce00e 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,14).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,15).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,15).sql index 4555970c612..334fe0fe096 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,15).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,14).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,14).sql index 9b04f777e3a..7ea37a275b6 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,14).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,15).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,15).sql index 1a3c1c09a43..4953da271dd 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,15).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,14).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,14).sql index 2c412bbe074..ac7135941fc 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,14).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,15).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,15).sql index 892ff1b84d6..9e5619039f1 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,15).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,14).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,14).sql index 9b04f777e3a..7ea37a275b6 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,14).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,15).sql b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,15).sql index 1a3c1c09a43..4953da271dd 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,15).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client.LinqService).sql index ff177402b24..ab416601779 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2.ParentID, a_2.Value1, - z_1.ParentID, - z_1.Value1, + z_2.ParentID, + z_2.Value1, y.ParentID, y.Value1, a.ParentID, @@ -19,6 +19,13 @@ FROM LEFT JOIN Parent y ON a_2.ParentID = y.ParentID LEFT JOIN Parent a ON a_2.ParentID = a.ParentID LEFT JOIN Parent z ON a_2.ParentID = z.ParentID - LEFT JOIN Parent z_1 ON a_2.ParentID = Coalesce(z_1.Value1, 1) + LEFT JOIN ( + SELECT + z_1.ParentID as ParentID, + z_1.Value1 as Value1, + Coalesce(z_1.Value1, 1) as c1 + FROM + Parent z_1 + ) z_2 ON a_2.ParentID = z_2.c1 LEFT JOIN Parent a_1 ON a_2.ParentID = a_1.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client.LinqService).sql index 3ae68819299..6c71266773d 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client.LinqService).sql index a07a19a9342..9adbabe7834 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> 1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql index 91afe9a09e4..c1779496988 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client.LinqService).sql index 23a1789ac66..3619d9beaa6 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -14,7 +14,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> 2 AND left2.ParentID <> 1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql index a624834aae7..640ee4c91e4 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client.LinqService).sql index 6b5175077af..25862ca56ac 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client.LinqService).sql @@ -355,13 +355,13 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1) + maxOrNull(x.OrderData1) LIMIT 0, 3 BeforeExecute @@ -377,13 +377,13 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - minOrNull(g_1.OrderData1) DESC + minOrNull(x.OrderData1) DESC LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client.LinqService).sql index 5a6be92feda..971c0c237eb 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client.LinqService).sql @@ -355,13 +355,13 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1 % 3) + maxOrNull(x.OrderData1 % 3) LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client.LinqService).sql index fad0d89415d..e7c88bab86c 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID DESC + ch.ChildID % 2, + ch.ChildID DESC diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client.LinqService).sql index 986c8281e1b..9a64de4d953 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - x.ChildID % 2, - x.ChildID + x.ChildID, + x.ChildID % 2 diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client.LinqService).sql index 986c8281e1b..96ef070380a 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID + ch.ChildID % 2, + ch.ChildID diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client.LinqService).sql index 134e4f1dd26..001539b12ee 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2 DESC, - x.ChildID DESC + ch.ChildID % 2 DESC, + ch.ChildID DESC diff --git a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client.LinqService).sql index a8186db03ba..fc94b163e24 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client.LinqService).sql @@ -2,17 +2,21 @@ -- ClickHouse.Client ClickHouse SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN true + ELSE false + END as flag, + t1.PersonID as ID, + t1.LastName as LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.flag diff --git a/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..39a0571e700 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Client.LinqService).sql @@ -0,0 +1,123 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- ClickHouse.Client ClickHouse + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int32, + Nullable1 Nullable(Int32), + Nullable2 Nullable(Int32), + Nullable3 Nullable(Int32), + + PRIMARY KEY (Id) +) +ENGINE = MergeTree() +ORDER BY Id + +BeforeExecute +-- ClickHouse.Client ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 1, + 10, + NULL, + NULL +) + +BeforeExecute +-- ClickHouse.Client ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 2, + NULL, + 20, + NULL +) + +BeforeExecute +-- ClickHouse.Client ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 3, + NULL, + NULL, + 30 +) + +BeforeExecute +-- ClickHouse.Client ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 4, + NULL, + NULL, + NULL +) + +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + Coalesce(t.Nullable1, t.Nullable2, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable1, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable3, t.Nullable1, t.Id), + Coalesce(t.Nullable3, t.Nullable1, t.Nullable2, t.Id), + Coalesce(t.Nullable3, t.Nullable2, t.Nullable1, t.Id), + t.Id, + Coalesce(t.Nullable1, t.Id), + Coalesce(t.Nullable1, t.Nullable2, t.Id) +FROM + CoalesceNullableFields t + +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- ClickHouse.Client ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client.LinqService).sql index 6cfda8929ca..13b2defd759 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client.LinqService).sql @@ -77,14 +77,14 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - m_1.Id, + t2.Id, c_1.Id, c_1.Value, t1.Id, t1.Value_1 FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t2 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t2.Id LEFT JOIN ( SELECT sc.Id as Id, @@ -94,7 +94,7 @@ FROM LIMIT 1 ) t1 ON 1=1 ORDER BY - m_1.Id + t2.Id BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client.LinqService).sql index ad9cfb1ac09..57498066cb6 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client.LinqService).sql @@ -80,8 +80,8 @@ SELECT c_1.Id, c_1.Value FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t1 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t1.Id ORDER BY c_1.Id DESC diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..44f0fc8c9f6 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Client.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Coalesce(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..400cf10b076 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Client.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client.LinqService).sql index 040dbd7c5f5..400cf10b076 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client.LinqService).sql @@ -2,17 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client.LinqService).sql index 22aeeed7544..ae4875786c1 100644 --- a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client.LinqService).sql @@ -2,14 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..92dfc762e19 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Client.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..4cbac7c7e43 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Client.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..ae4875786c1 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Client.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..1a12134db89 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Client.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..040dbd7c5f5 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Client.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Client.LinqService).sql new file mode 100644 index 00000000000..22aeeed7544 --- /dev/null +++ b/ClickHouse.Client.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Client.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,False).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,False).sql index 3e066267817..508c2c29afd 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,False).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,True).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,True).sql index 3e066267817..508c2c29afd 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,True).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,False).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,False).sql index 295de4b2f16..17ece2051bf 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,False).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,True).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,True).sql index 295de4b2f16..17ece2051bf 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,True).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client.LinqService).sql index 8ca5e72a654..1253da52b4d 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID as ParentID, @@ -24,9 +24,9 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID LIMIT 10 diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client.LinqService).sql index e665c8be3bb..bc677cc2abb 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client.LinqService).sql b/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client.LinqService).sql index fdc744637c9..8e7ba3adf8c 100644 --- a/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client.LinqService).sql +++ b/ClickHouse.Client.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10, 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Client/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client).sql index 6babb530323..52a6793199e 100644 --- a/ClickHouse.Client/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Client).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) + WHEN t1.ParentID_1 IS NULL THEN 0 + ELSE t1.ParentID_1 END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - Parent p + ( + SELECT + p.ParentID as ParentID, + ( + SELECT + c_1.ParentID + FROM + Child c_1 + WHERE + c_1.ParentID > 0 + ORDER BY + c_1.ParentID + LIMIT 1 + ) as ParentID_1 + FROM + Parent p + ) t1 ORDER BY - p.ParentID + t1.ParentID diff --git a/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client,False).sql b/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client,False).sql index 9c9af747e97..82377552c10 100644 --- a/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client,False).sql +++ b/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Client,False).sql @@ -36,22 +36,24 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue FROM - Issue4167Table g_1 -WHERE - g_1.Value = '000001' -GROUP BY - g_1.Value, - g_1.EnumValue + ( + SELECT + CASE + WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue + ELSE 0 + END as EnumValue + FROM + Issue4167Table g_1 + WHERE + g_1.Value = '000001' + GROUP BY + g_1.Value, + g_1.EnumValue + ) t1 ORDER BY - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client).sql index 357ad2a7685..a204f48a3b1 100644 --- a/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Client).sql @@ -66,10 +66,10 @@ SELECT c4.ChildID, c4.ParentID FROM - Child p - INNER JOIN Child c4 ON c4.ParentID = p.ParentID + Child c_1 + INNER JOIN Child c4 ON c4.ParentID = c_1.ParentID WHERE - p.ParentID > 1 AND c4.ParentID % 2 = 0 + c_1.ParentID > 1 AND c4.ParentID % 2 = 0 ORDER BY c4.ChildID, c4.ParentID diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client).sql index 2e2827a88a3..13f264d3760 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addDays(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client).sql index 4ec40b947d3..a964a6aa69a 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addHours(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client).sql index e8212bd78d8..8149aa88ff3 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM fromUnixTimestamp64Nano(toUnixTimestamp64Nano(x.TransactionDate) + toInt64(toFloat64(-1000000))) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client).sql index d08cccc5209..ff90f5a10b1 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addMinutes(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client).sql index 3e2689422cd..6e5da3f9e18 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addMonths(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client).sql index 33befb78851..14d8c16c8cf 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addSeconds(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client).sql index 843cc45c251..a6fc7c3be5e 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addYears(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client).sql index 17e7a99ef67..412e57a4419 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDate32(x.TransactionDate) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client).sql index 7274b5d0cc2..03ab9d1536d 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.DayOfWeek, + t1.DayOfWeek, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfWeek(addDays(x.TransactionDate, 1)) - 1 as DayOfWeek FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfWeek + t1.DayOfWeek ORDER BY - x_1.DayOfWeek + t1.DayOfWeek BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client).sql index 627ad89177f..fc27a9f92ed 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.DayOfYear, + t1.DayOfYear, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfYear(x.TransactionDate) as DayOfYear FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfYear + t1.DayOfYear ORDER BY - x_1.DayOfYear + t1.DayOfYear BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client).sql index 4e96b89d26f..259744d5913 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Day_1, + t1.Day_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfMonth(x.TransactionDate) as Day_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Day_1 + t1.Day_1 ORDER BY - x_1.Day_1 + t1.Day_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client).sql index 46f6e240aae..a1756a30db3 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Hour_1, + t1.Hour_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toHour(x.TransactionDate) as Hour_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Hour_1 + t1.Hour_1 ORDER BY - x_1.Hour_1 + t1.Hour_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client).sql index f96082f55ed..959b4bd2159 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Millisecond, + t1.Millisecond, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toUnixTimestamp64Milli(x.TransactionDate) % 1000 as Millisecond FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Millisecond + t1.Millisecond ORDER BY - x_1.Millisecond + t1.Millisecond BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client).sql index 42406b64ecd..8186203d976 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Minute_1, + t1.Minute_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toMinute(x.TransactionDate) as Minute_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Minute_1 + t1.Minute_1 ORDER BY - x_1.Minute_1 + t1.Minute_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client).sql index c7b2d850cd1..1133122c016 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Month_1, + t1.Month_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toMonth(x.TransactionDate) as Month_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Month_1 + t1.Month_1 ORDER BY - x_1.Month_1 + t1.Month_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client).sql index 970f82cfbcb..62c1d056172 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Second_1, + t1.Second_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toSecond(x.TransactionDate) as Second_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Second_1 + t1.Second_1 ORDER BY - x_1.Second_1 + t1.Second_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client).sql index ba329492f00..90970020a68 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toInt64((toUnixTimestamp64Nano(toDateTime64(x.TransactionDate, 7)) - toUnixTimestamp64Nano(toDateTime64(toDate32(x.TransactionDate), 7))) / 100) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client).sql index 5b1524a66e4..15c83d0ad0b 100644 --- a/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Client).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - x_1.Year_1, + t1.Year_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toYear(x.TransactionDate) as Year_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Year_1 + t1.Year_1 ORDER BY - x_1.Year_1 + t1.Year_1 BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client).sql index 8b7afd5e0dd..84cd982a4e1 100644 --- a/ClickHouse.Client/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Client).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d.ParentID as ParentID, - d.ChildID as ChildID + d.ChildID as ChildID, + d.ParentID as ParentID FROM Child d WHERE diff --git a/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,1).sql b/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,1).sql index ba667768f35..57dcd6716d7 100644 --- a/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,1).sql +++ b/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,1).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 2 AS PersonID UNION ALL - SELECT 'Doe', 3) n ON p.PersonID = n.PersonID + SELECT 'Doe', 3) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,2).sql b/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,2).sql index 4a69b993515..d6c838e94c6 100644 --- a/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,2).sql +++ b/ClickHouse.Client/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Client,2).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 3 AS PersonID UNION ALL - SELECT 'Doe', 4) n ON p.PersonID = n.PersonID + SELECT 'Doe', 4) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Client/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client).sql index 84d4c5f7757..8f735b2cc72 100644 --- a/ClickHouse.Client/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Client).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - concat(t1.FirstName, ' ', t1.LastName) + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,14).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,14).sql index d308f6e0503..86579ede351 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,14).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,15).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,15).sql index 7a3c61cc3de..460a70ba4c2 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,15).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Client,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,14).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,14).sql index b3b54bd3736..3ceee340f25 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,14).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,15).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,15).sql index 1cf83d01af6..8ff4c8dbfd2 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,15).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Client,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,14).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,14).sql index a56c94953b1..2d88397213a 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,14).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,15).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,15).sql index d50db758e46..7139c089ca6 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,15).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Client,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,14).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,14).sql index b3b54bd3736..3ceee340f25 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,14).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,15).sql b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,15).sql index 1cf83d01af6..8ff4c8dbfd2 100644 --- a/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,15).sql +++ b/ClickHouse.Client/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Client,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Client/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Client).sql index afb0cb3802a..05bde41b4ef 100644 --- a/ClickHouse.Client/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Client).sql @@ -3,7 +3,7 @@ SELECT person_1.PersonID, - y_1.PersonID + t1.PersonID FROM ( SELECT @@ -19,8 +19,8 @@ FROM Patient pat WHERE pat.Diagnosis = 'b' - ) y_1 - INNER JOIN Person person_1 ON y_1.PersonID = person_1.PersonID + ) t1 + INNER JOIN Person person_1 ON t1.PersonID = person_1.PersonID ORDER BY person_1.PersonID diff --git a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client).sql index ff177402b24..ab416601779 100644 --- a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Client).sql @@ -4,8 +4,8 @@ SELECT a_2.ParentID, a_2.Value1, - z_1.ParentID, - z_1.Value1, + z_2.ParentID, + z_2.Value1, y.ParentID, y.Value1, a.ParentID, @@ -19,6 +19,13 @@ FROM LEFT JOIN Parent y ON a_2.ParentID = y.ParentID LEFT JOIN Parent a ON a_2.ParentID = a.ParentID LEFT JOIN Parent z ON a_2.ParentID = z.ParentID - LEFT JOIN Parent z_1 ON a_2.ParentID = Coalesce(z_1.Value1, 1) + LEFT JOIN ( + SELECT + z_1.ParentID as ParentID, + z_1.Value1 as Value1, + Coalesce(z_1.Value1, 1) as c1 + FROM + Parent z_1 + ) z_2 ON a_2.ParentID = z_2.c1 LEFT JOIN Parent a_1 ON a_2.ParentID = a_1.ParentID diff --git a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client).sql index 3ae68819299..6c71266773d 100644 --- a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Client).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client).sql index a07a19a9342..9adbabe7834 100644 --- a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Client).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> 1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql index 91afe9a09e4..c1779496988 100644 --- a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client).sql index 23a1789ac66..3619d9beaa6 100644 --- a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Client).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -14,7 +14,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> 2 AND left2.ParentID <> 1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql index a624834aae7..640ee4c91e4 100644 --- a/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Client).sql @@ -2,7 +2,7 @@ -- ClickHouse.Client ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client).sql index 9450b4f5ac9..5094c3abcee 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Client).sql @@ -61,13 +61,13 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1) + maxOrNull(x.OrderData1) LIMIT 0, 3 BeforeExecute @@ -83,13 +83,13 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - minOrNull(g_1.OrderData1) DESC + minOrNull(x.OrderData1) DESC LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client).sql index 0931cdfd8e8..14cbdddccb8 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Client).sql @@ -61,13 +61,13 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1 % 3) + maxOrNull(x.OrderData1 % 3) LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client).sql index fad0d89415d..e7c88bab86c 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Client).sql @@ -2,11 +2,11 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID DESC + ch.ChildID % 2, + ch.ChildID DESC diff --git a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client).sql index 986c8281e1b..9a64de4d953 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Client).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - x.ChildID % 2, - x.ChildID + x.ChildID, + x.ChildID % 2 diff --git a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client).sql index 986c8281e1b..96ef070380a 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Client).sql @@ -2,11 +2,11 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID + ch.ChildID % 2, + ch.ChildID diff --git a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client).sql index 134e4f1dd26..001539b12ee 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Client).sql @@ -2,11 +2,11 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2 DESC, - x.ChildID DESC + ch.ChildID % 2 DESC, + ch.ChildID DESC diff --git a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client).sql index a8186db03ba..fc94b163e24 100644 --- a/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Client).sql @@ -2,17 +2,21 @@ -- ClickHouse.Client ClickHouse SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN true + ELSE false + END as flag, + t1.PersonID as ID, + t1.LastName as LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.flag diff --git a/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Client).sql new file mode 100644 index 00000000000..46df7e9fafa --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Client).sql @@ -0,0 +1,67 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- ClickHouse.Client ClickHouse + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int32, + Nullable1 Nullable(Int32), + Nullable2 Nullable(Int32), + Nullable3 Nullable(Int32), + + PRIMARY KEY (Id) +) +ENGINE = MergeTree() +ORDER BY Id + +BeforeExecute +-- ClickHouse.Client ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + Coalesce(t.Nullable1, t.Nullable2, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable1, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable3, t.Nullable1, t.Id), + Coalesce(t.Nullable3, t.Nullable1, t.Nullable2, t.Id), + Coalesce(t.Nullable3, t.Nullable2, t.Nullable1, t.Id), + t.Id, + Coalesce(t.Nullable1, t.Id), + Coalesce(t.Nullable1, t.Nullable2, t.Id) +FROM + CoalesceNullableFields t + +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- ClickHouse.Client ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client).sql index ad449b141cb..8ef48dfad50 100644 --- a/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Client).sql @@ -58,14 +58,14 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - m_1.Id, + t2.Id, c_1.Id, c_1.Value, t1.Id, t1.Value_1 FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t2 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t2.Id LEFT JOIN ( SELECT sc.Id as Id, @@ -75,7 +75,7 @@ FROM LIMIT 1 ) t1 ON 1=1 ORDER BY - m_1.Id + t2.Id BeforeExecute -- ClickHouse.Client ClickHouse diff --git a/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client).sql index 4a86be296a5..445ae87ea4c 100644 --- a/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Client).sql @@ -61,8 +61,8 @@ SELECT c_1.Id, c_1.Value FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t1 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t1.Id ORDER BY c_1.Id DESC diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Client).sql new file mode 100644 index 00000000000..44f0fc8c9f6 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Client).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Coalesce(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Client).sql new file mode 100644 index 00000000000..400cf10b076 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Client).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client).sql index 040dbd7c5f5..400cf10b076 100644 --- a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Client).sql @@ -2,17 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client).sql index 22aeeed7544..ae4875786c1 100644 --- a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Client).sql @@ -2,14 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Client).sql new file mode 100644 index 00000000000..92dfc762e19 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Client).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Client).sql new file mode 100644 index 00000000000..4cbac7c7e43 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Client).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Client).sql new file mode 100644 index 00000000000..ae4875786c1 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Client).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Client).sql new file mode 100644 index 00000000000..1a12134db89 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Client).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Client).sql new file mode 100644 index 00000000000..040dbd7c5f5 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Client).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Client).sql b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Client).sql new file mode 100644 index 00000000000..22aeeed7544 --- /dev/null +++ b/ClickHouse.Client/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Client).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Client ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,False).sql b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,False).sql index 3e066267817..508c2c29afd 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,False).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,True).sql b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,True).sql index 3e066267817..508c2c29afd 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,True).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Client,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,False).sql b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,False).sql index 295de4b2f16..17ece2051bf 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,False).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,True).sql b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,True).sql index 295de4b2f16..17ece2051bf 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,True).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Client,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Client ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client).sql b/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client).sql index 8ca5e72a654..1253da52b4d 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Client).sql @@ -2,10 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID as ParentID, @@ -24,9 +24,9 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID LIMIT 10 diff --git a/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client).sql b/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client).sql index e665c8be3bb..bc677cc2abb 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Client).sql @@ -2,10 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client).sql b/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client).sql index fdc744637c9..8e7ba3adf8c 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Client).sql @@ -2,10 +2,10 @@ -- ClickHouse.Client ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10, 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,2).sql b/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,2).sql index cef24dcae9c..7798b87dc82 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,2).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,2).sql @@ -60,7 +60,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - m_1.ID, + m_1.Key_1, d.id, d.id2, d.id3, @@ -69,7 +69,7 @@ SELECT FROM ( SELECT - x.id as ID + x.id as Key_1 FROM T1 x LEFT JOIN T2 order_1 ON x.id = order_1.id AND order_1.id2 = 2 @@ -81,7 +81,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN T1 d ON m_1.ID = d.id + INNER JOIN T1 d ON m_1.Key_1 = d.id LEFT JOIN T2 order_2 ON d.id = order_2.id AND order_2.id2 = 2 WHERE d.id2 = 2 diff --git a/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,85).sql b/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,85).sql index 2d93004562d..bac2370ca76 100644 --- a/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,85).sql +++ b/ClickHouse.Client/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Client,85).sql @@ -60,7 +60,7 @@ BeforeExecute -- ClickHouse.Client ClickHouse SELECT - m_1.ID, + m_1.Key_1, d.id, d.id2, d.id3, @@ -69,7 +69,7 @@ SELECT FROM ( SELECT - x.id as ID + x.id as Key_1 FROM T1 x LEFT JOIN T2 order_1 ON x.id = order_1.id AND order_1.id2 = 85 @@ -81,7 +81,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN T1 d ON m_1.ID = d.id + INNER JOIN T1 d ON m_1.Key_1 = d.id LEFT JOIN T2 order_2 ON d.id = order_2.id AND order_2.id2 = 85 WHERE d.id2 = 85 diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql.LinqService).sql index 2a0b4ecbfbf..3171dfb9a86 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) + WHEN t1.ParentID_1 IS NULL THEN 0 + ELSE t1.ParentID_1 END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - Parent p + ( + SELECT + p.ParentID as ParentID, + ( + SELECT + c_1.ParentID + FROM + Child c_1 + WHERE + c_1.ParentID > 0 + ORDER BY + c_1.ParentID + LIMIT 1 + ) as ParentID_1 + FROM + Parent p + ) t1 ORDER BY - p.ParentID + t1.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql.LinqService,False).sql b/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql.LinqService,False).sql index 0af56a7624d..bea7f67ef35 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql.LinqService,False).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql.LinqService,False).sql @@ -85,22 +85,24 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue FROM - Issue4167Table g_1 -WHERE - g_1.Value = '000001' -GROUP BY - g_1.Value, - g_1.EnumValue + ( + SELECT + CASE + WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue + ELSE 0 + END as EnumValue + FROM + Issue4167Table g_1 + WHERE + g_1.Value = '000001' + GROUP BY + g_1.Value, + g_1.EnumValue + ) t1 ORDER BY - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql.LinqService).sql index 0202382a2fc..da6bb2e33ce 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql.LinqService).sql @@ -66,10 +66,10 @@ SELECT c4.ChildID, c4.ParentID FROM - Child p - INNER JOIN Child c4 ON c4.ParentID = p.ParentID + Child c_1 + INNER JOIN Child c4 ON c4.ParentID = c_1.ParentID WHERE - p.ParentID > 1 AND c4.ParentID % 2 = 0 + c_1.ParentID > 1 AND c4.ParentID % 2 = 0 ORDER BY c4.ChildID, c4.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql.LinqService).sql index ed2553cf123..ecb0e3dae46 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDate32(x.TransactionDate) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql.LinqService).sql index ccf9fd71964..78a74d72a8b 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.DayOfWeek, + t1.DayOfWeek, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfWeek(addDays(x.TransactionDate, 1)) - 1 as DayOfWeek FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfWeek + t1.DayOfWeek ORDER BY - x_1.DayOfWeek + t1.DayOfWeek BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql.LinqService).sql index e93564a8518..4c0f3aabb56 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.DayOfYear, + t1.DayOfYear, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfYear(x.TransactionDate) as DayOfYear FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfYear + t1.DayOfYear ORDER BY - x_1.DayOfYear + t1.DayOfYear BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql.LinqService).sql index 0443c342d51..1d7b61b48f6 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Day_1, + t1.Day_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfMonth(x.TransactionDate) as Day_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Day_1 + t1.Day_1 ORDER BY - x_1.Day_1 + t1.Day_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql.LinqService).sql index 8958d345fd1..e3ab149bf76 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Hour_1, + t1.Hour_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toHour(x.TransactionDate) as Hour_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Hour_1 + t1.Hour_1 ORDER BY - x_1.Hour_1 + t1.Hour_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql.LinqService).sql index 1d6b935e338..d833a4154a1 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Millisecond, + t1.Millisecond, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toUnixTimestamp64Milli(x.TransactionDate) % 1000 as Millisecond FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Millisecond + t1.Millisecond ORDER BY - x_1.Millisecond + t1.Millisecond BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql.LinqService).sql index aaad5d9752a..55404f9955c 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Minute_1, + t1.Minute_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toMinute(x.TransactionDate) as Minute_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Minute_1 + t1.Minute_1 ORDER BY - x_1.Minute_1 + t1.Minute_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql.LinqService).sql index 5ee67720968..ba4f7ca7095 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Month_1, + t1.Month_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toMonth(x.TransactionDate) as Month_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Month_1 + t1.Month_1 ORDER BY - x_1.Month_1 + t1.Month_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql.LinqService).sql index ce449ea8566..7faa4b01ef8 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Second_1, + t1.Second_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toSecond(x.TransactionDate) as Second_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Second_1 + t1.Second_1 ORDER BY - x_1.Second_1 + t1.Second_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql.LinqService).sql index 9e0e8d51c76..0cf6ae34afe 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toInt64((toUnixTimestamp64Nano(toDateTime64(x.TransactionDate, 7)) - toUnixTimestamp64Nano(toDateTime64(toDate32(x.TransactionDate), 7))) / 100) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql.LinqService).sql index 282a77e72e2..bb071a79920 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Year_1, + t1.Year_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toYear(x.TransactionDate) as Year_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Year_1 + t1.Year_1 ORDER BY - x_1.Year_1 + t1.Year_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql.LinqService).sql index 954c8784182..b7fc942c1e1 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql.LinqService).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d.ParentID as ParentID, - d.ChildID as ChildID + d.ChildID as ChildID, + d.ParentID as ParentID FROM Child d WHERE diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,1).sql b/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,1).sql index f8516751532..071d6682eb8 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,1).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,1).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 2 AS PersonID UNION ALL - SELECT 'Doe', 3) n ON p.PersonID = n.PersonID + SELECT 'Doe', 3) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,2).sql b/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,2).sql index 05f7e1794c2..3dc90f1c622 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,2).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql.LinqService,2).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 3 AS PersonID UNION ALL - SELECT 'Doe', 4) n ON p.PersonID = n.PersonID + SELECT 'Doe', 4) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql.LinqService).sql index 516fbfee88e..2d019c0fe6e 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - concat(t1.FirstName, ' ', t1.LastName) + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,14).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,14).sql index 3323a6c3e77..f040dac60a6 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,14).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,15).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,15).sql index 2a8c85f44fa..b3d3894e5a6 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,15).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,14).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,14).sql index 298b86c3d35..4f542151fff 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,14).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,15).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,15).sql index 2d9958c6f95..ed9066d9096 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,15).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,14).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,14).sql index e8d5f3ca838..78393f51750 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,14).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,15).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,15).sql index c470037f64f..88563548222 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,15).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,14).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,14).sql index 298b86c3d35..4f542151fff 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,14).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,15).sql b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,15).sql index 2d9958c6f95..ed9066d9096 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,15).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql.LinqService).sql index 6cf5ebe6a16..4b39635d952 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2.ParentID, a_2.Value1, - z_1.ParentID, - z_1.Value1, + z_2.ParentID, + z_2.Value1, y.ParentID, y.Value1, a.ParentID, @@ -19,6 +19,13 @@ FROM LEFT JOIN Parent y ON a_2.ParentID = y.ParentID LEFT JOIN Parent a ON a_2.ParentID = a.ParentID LEFT JOIN Parent z ON a_2.ParentID = z.ParentID - LEFT JOIN Parent z_1 ON a_2.ParentID = Coalesce(z_1.Value1, 1) + LEFT JOIN ( + SELECT + z_1.ParentID as ParentID, + z_1.Value1 as Value1, + Coalesce(z_1.Value1, 1) as c1 + FROM + Parent z_1 + ) z_2 ON a_2.ParentID = z_2.c1 LEFT JOIN Parent a_1 ON a_2.ParentID = a_1.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql.LinqService).sql index 3face9ed0bb..7b5e391568d 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql.LinqService).sql index 4e77ee56c31..1716972d2a2 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> 1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql index 43b49c5b6f7..80570105ccd 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql.LinqService).sql index cb832a4e3f0..60907c1303a 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -14,7 +14,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> 2 AND left2.ParentID <> 1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql index 3fc093689e9..eb911665362 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql.LinqService).sql index 3d240925fe9..cd3ee729de4 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql.LinqService).sql @@ -355,13 +355,13 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1) + maxOrNull(x.OrderData1) LIMIT 0, 3 BeforeExecute @@ -377,13 +377,13 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - minOrNull(g_1.OrderData1) DESC + minOrNull(x.OrderData1) DESC LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql.LinqService).sql index 17e88d387da..fa31b36b224 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql.LinqService).sql @@ -355,13 +355,13 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1 % 3) + maxOrNull(x.OrderData1 % 3) LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql.LinqService).sql index 2e320ca8286..3012dc2d82f 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID DESC + ch.ChildID % 2, + ch.ChildID DESC diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql.LinqService).sql index 01cc2ce9839..695cf55fd51 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - x.ChildID % 2, - x.ChildID + x.ChildID, + x.ChildID % 2 diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql.LinqService).sql index 01cc2ce9839..562fa47b7b8 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID + ch.ChildID % 2, + ch.ChildID diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql.LinqService).sql index 2ee7250866d..2b0b6f33820 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2 DESC, - x.ChildID DESC + ch.ChildID % 2 DESC, + ch.ChildID DESC diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql.LinqService).sql index 6084961738d..101e0f4c246 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql.LinqService).sql @@ -2,17 +2,21 @@ -- ClickHouse.MySql ClickHouse SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN true + ELSE false + END as flag, + t1.PersonID as ID, + t1.LastName as LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.flag diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..a08a0d24a76 --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,123 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int32, + Nullable1 Nullable(Int32), + Nullable2 Nullable(Int32), + Nullable3 Nullable(Int32), + + PRIMARY KEY (Id) +) +ENGINE = MergeTree() +ORDER BY Id + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 1, + 10, + NULL, + NULL +) + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 2, + NULL, + 20, + NULL +) + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 3, + NULL, + NULL, + 30 +) + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 4, + NULL, + NULL, + NULL +) + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + Coalesce(t.Nullable1, t.Nullable2, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable1, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable3, t.Nullable1, t.Id), + Coalesce(t.Nullable3, t.Nullable1, t.Nullable2, t.Id), + Coalesce(t.Nullable3, t.Nullable2, t.Nullable1, t.Id), + t.Id, + Coalesce(t.Nullable1, t.Id), + Coalesce(t.Nullable1, t.Nullable2, t.Id) +FROM + CoalesceNullableFields t + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql.LinqService).sql index 6747e7efd95..cc0d62a04f3 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql.LinqService).sql @@ -77,14 +77,14 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - m_1.Id, + t2.Id, c_1.Id, c_1.Value, t1.Id, t1.Value_1 FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t2 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t2.Id LEFT JOIN ( SELECT sc.Id as Id, @@ -94,7 +94,7 @@ FROM LIMIT 1 ) t1 ON 1=1 ORDER BY - m_1.Id + t2.Id BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql.LinqService).sql index 304cdcf255a..a23e9fd64a3 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql.LinqService).sql @@ -80,8 +80,8 @@ SELECT c_1.Id, c_1.Value FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t1 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t1.Id ORDER BY c_1.Id DESC diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..9bb7f6c387b --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Coalesce(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..e810a2dad36 --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql.LinqService).sql index 491686b69ee..e810a2dad36 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql.LinqService).sql @@ -2,17 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql.LinqService).sql index b9d0a538e37..f0c8efce5e0 100644 --- a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql.LinqService).sql @@ -2,14 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..1172cd768dd --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..8e497743655 --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..f0c8efce5e0 --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..761e2566c36 --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..491686b69ee --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.MySql.LinqService).sql new file mode 100644 index 00000000000..b9d0a538e37 --- /dev/null +++ b/ClickHouse.MySql.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.MySql.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,False).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,False).sql index 9f585aa30ab..710c0fb21e5 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,False).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,True).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,True).sql index 9f585aa30ab..710c0fb21e5 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,True).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,False).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,False).sql index 65e2273b034..7691b482c49 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,False).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,True).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,True).sql index 65e2273b034..7691b482c49 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,True).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql.LinqService).sql index 3094d0a8d4e..f4ec22b2fd6 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID as ParentID, @@ -24,9 +24,9 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID LIMIT 10 diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql.LinqService).sql index dd9cf8b037c..cfa96572cb2 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql.LinqService).sql b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql.LinqService).sql index f68e2fae093..a54bdbd325b 100644 --- a/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql.LinqService).sql +++ b/ClickHouse.MySql.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10, 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.MySql/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql).sql index 2a0b4ecbfbf..3171dfb9a86 100644 --- a/ClickHouse.MySql/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.MySql).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) + WHEN t1.ParentID_1 IS NULL THEN 0 + ELSE t1.ParentID_1 END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - Parent p + ( + SELECT + p.ParentID as ParentID, + ( + SELECT + c_1.ParentID + FROM + Child c_1 + WHERE + c_1.ParentID > 0 + ORDER BY + c_1.ParentID + LIMIT 1 + ) as ParentID_1 + FROM + Parent p + ) t1 ORDER BY - p.ParentID + t1.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql,False).sql b/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql,False).sql index 7200becd076..d2ae218d57c 100644 --- a/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql,False).sql +++ b/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.MySql,False).sql @@ -36,22 +36,24 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue FROM - Issue4167Table g_1 -WHERE - g_1.Value = '000001' -GROUP BY - g_1.Value, - g_1.EnumValue + ( + SELECT + CASE + WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue + ELSE 0 + END as EnumValue + FROM + Issue4167Table g_1 + WHERE + g_1.Value = '000001' + GROUP BY + g_1.Value, + g_1.EnumValue + ) t1 ORDER BY - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql).sql index 0202382a2fc..da6bb2e33ce 100644 --- a/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.MySql).sql @@ -66,10 +66,10 @@ SELECT c4.ChildID, c4.ParentID FROM - Child p - INNER JOIN Child c4 ON c4.ParentID = p.ParentID + Child c_1 + INNER JOIN Child c4 ON c4.ParentID = c_1.ParentID WHERE - p.ParentID > 1 AND c4.ParentID % 2 = 0 + c_1.ParentID > 1 AND c4.ParentID % 2 = 0 ORDER BY c4.ChildID, c4.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql).sql index dc38d924015..2efeaaed0bb 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDate32(x.TransactionDate) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql).sql index 4369e6a3af0..baeb8663857 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.DayOfWeek, + t1.DayOfWeek, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfWeek(addDays(x.TransactionDate, 1)) - 1 as DayOfWeek FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfWeek + t1.DayOfWeek ORDER BY - x_1.DayOfWeek + t1.DayOfWeek BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql).sql index 5bb57b6ce06..cbfcf4bd959 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.DayOfYear, + t1.DayOfYear, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfYear(x.TransactionDate) as DayOfYear FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfYear + t1.DayOfYear ORDER BY - x_1.DayOfYear + t1.DayOfYear BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql).sql index f827fa465bc..ae022d6bc3c 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Day_1, + t1.Day_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfMonth(x.TransactionDate) as Day_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Day_1 + t1.Day_1 ORDER BY - x_1.Day_1 + t1.Day_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql).sql index 0a4747a5276..1c4cb35c8df 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Hour_1, + t1.Hour_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toHour(x.TransactionDate) as Hour_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Hour_1 + t1.Hour_1 ORDER BY - x_1.Hour_1 + t1.Hour_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql).sql index cfb7967e9aa..064c4945949 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Millisecond, + t1.Millisecond, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toUnixTimestamp64Milli(x.TransactionDate) % 1000 as Millisecond FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Millisecond + t1.Millisecond ORDER BY - x_1.Millisecond + t1.Millisecond BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql).sql index ec5ac9923d6..c4964b739b7 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Minute_1, + t1.Minute_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toMinute(x.TransactionDate) as Minute_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Minute_1 + t1.Minute_1 ORDER BY - x_1.Minute_1 + t1.Minute_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql).sql index bcad174b6af..64a039b3af1 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Month_1, + t1.Month_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toMonth(x.TransactionDate) as Month_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Month_1 + t1.Month_1 ORDER BY - x_1.Month_1 + t1.Month_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql).sql index baef0103c58..250639e04ec 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Second_1, + t1.Second_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toSecond(x.TransactionDate) as Second_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Second_1 + t1.Second_1 ORDER BY - x_1.Second_1 + t1.Second_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql).sql index efd9540f727..962b2f4ec05 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toInt64((toUnixTimestamp64Nano(toDateTime64(x.TransactionDate, 7)) - toUnixTimestamp64Nano(toDateTime64(toDate32(x.TransactionDate), 7))) / 100) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql).sql index 4a10b1363b6..1240c38b5c5 100644 --- a/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.MySql).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - x_1.Year_1, + t1.Year_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toYear(x.TransactionDate) as Year_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Year_1 + t1.Year_1 ORDER BY - x_1.Year_1 + t1.Year_1 BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql).sql index 954c8784182..b7fc942c1e1 100644 --- a/ClickHouse.MySql/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.MySql).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d.ParentID as ParentID, - d.ChildID as ChildID + d.ChildID as ChildID, + d.ParentID as ParentID FROM Child d WHERE diff --git a/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,1).sql b/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,1).sql index f8516751532..071d6682eb8 100644 --- a/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,1).sql +++ b/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,1).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 2 AS PersonID UNION ALL - SELECT 'Doe', 3) n ON p.PersonID = n.PersonID + SELECT 'Doe', 3) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,2).sql b/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,2).sql index 05f7e1794c2..3dc90f1c622 100644 --- a/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,2).sql +++ b/ClickHouse.MySql/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.MySql,2).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 3 AS PersonID UNION ALL - SELECT 'Doe', 4) n ON p.PersonID = n.PersonID + SELECT 'Doe', 4) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.MySql/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql).sql index 516fbfee88e..2d019c0fe6e 100644 --- a/ClickHouse.MySql/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.MySql).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - concat(t1.FirstName, ' ', t1.LastName) + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,14).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,14).sql index bd090b1cf23..63f93a5ee1a 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,14).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,15).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,15).sql index 19961b70453..eefbbfb9cf8 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,15).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.MySql,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,14).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,14).sql index 085d888e703..d30ebc5ab57 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,14).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,15).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,15).sql index 3d74c59e1d6..750f2a483ac 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,15).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.MySql,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,14).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,14).sql index 642fd8e41d8..6c37d2c104e 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,14).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,15).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,15).sql index 974da1e4064..d1332e9225c 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,15).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.MySql,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,14).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,14).sql index 085d888e703..d30ebc5ab57 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,14).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,15).sql b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,15).sql index 3d74c59e1d6..750f2a483ac 100644 --- a/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,15).sql +++ b/ClickHouse.MySql/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.MySql,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.MySql/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.MySql).sql index 9494725d697..06aff360f09 100644 --- a/ClickHouse.MySql/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.MySql).sql @@ -3,7 +3,7 @@ SELECT person_1.PersonID, - y_1.PersonID + t1.PersonID FROM ( SELECT @@ -19,8 +19,8 @@ FROM Patient pat WHERE pat.Diagnosis = 'b' - ) y_1 - INNER JOIN Person person_1 ON y_1.PersonID = person_1.PersonID + ) t1 + INNER JOIN Person person_1 ON t1.PersonID = person_1.PersonID ORDER BY person_1.PersonID diff --git a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql).sql index 6cf5ebe6a16..4b39635d952 100644 --- a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.MySql).sql @@ -4,8 +4,8 @@ SELECT a_2.ParentID, a_2.Value1, - z_1.ParentID, - z_1.Value1, + z_2.ParentID, + z_2.Value1, y.ParentID, y.Value1, a.ParentID, @@ -19,6 +19,13 @@ FROM LEFT JOIN Parent y ON a_2.ParentID = y.ParentID LEFT JOIN Parent a ON a_2.ParentID = a.ParentID LEFT JOIN Parent z ON a_2.ParentID = z.ParentID - LEFT JOIN Parent z_1 ON a_2.ParentID = Coalesce(z_1.Value1, 1) + LEFT JOIN ( + SELECT + z_1.ParentID as ParentID, + z_1.Value1 as Value1, + Coalesce(z_1.Value1, 1) as c1 + FROM + Parent z_1 + ) z_2 ON a_2.ParentID = z_2.c1 LEFT JOIN Parent a_1 ON a_2.ParentID = a_1.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql).sql index 3face9ed0bb..7b5e391568d 100644 --- a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.MySql).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql).sql index 4e77ee56c31..1716972d2a2 100644 --- a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.MySql).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> 1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql index 43b49c5b6f7..80570105ccd 100644 --- a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql).sql index cb832a4e3f0..60907c1303a 100644 --- a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.MySql).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -14,7 +14,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> 2 AND left2.ParentID <> 1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql index 3fc093689e9..eb911665362 100644 --- a/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.MySql).sql @@ -2,7 +2,7 @@ -- ClickHouse.MySql ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql).sql index dac73aca4ea..edd9e59c5a4 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.MySql).sql @@ -61,13 +61,13 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1) + maxOrNull(x.OrderData1) LIMIT 0, 3 BeforeExecute @@ -83,13 +83,13 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - minOrNull(g_1.OrderData1) DESC + minOrNull(x.OrderData1) DESC LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql).sql index f6932aa4a44..1f26b7118b9 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.MySql).sql @@ -61,13 +61,13 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1 % 3) + maxOrNull(x.OrderData1 % 3) LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql).sql index 2e320ca8286..3012dc2d82f 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.MySql).sql @@ -2,11 +2,11 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID DESC + ch.ChildID % 2, + ch.ChildID DESC diff --git a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql).sql index 01cc2ce9839..695cf55fd51 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.MySql).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - x.ChildID % 2, - x.ChildID + x.ChildID, + x.ChildID % 2 diff --git a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql).sql index 01cc2ce9839..562fa47b7b8 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.MySql).sql @@ -2,11 +2,11 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID + ch.ChildID % 2, + ch.ChildID diff --git a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql).sql index 2ee7250866d..2b0b6f33820 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.MySql).sql @@ -2,11 +2,11 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2 DESC, - x.ChildID DESC + ch.ChildID % 2 DESC, + ch.ChildID DESC diff --git a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql).sql index 6084961738d..101e0f4c246 100644 --- a/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.MySql).sql @@ -2,17 +2,21 @@ -- ClickHouse.MySql ClickHouse SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN true + ELSE false + END as flag, + t1.PersonID as ID, + t1.LastName as LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.flag diff --git a/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.MySql).sql new file mode 100644 index 00000000000..fe00d391b0a --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.MySql).sql @@ -0,0 +1,67 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int32, + Nullable1 Nullable(Int32), + Nullable2 Nullable(Int32), + Nullable3 Nullable(Int32), + + PRIMARY KEY (Id) +) +ENGINE = MergeTree() +ORDER BY Id + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + Coalesce(t.Nullable1, t.Nullable2, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable1, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable3, t.Nullable1, t.Id), + Coalesce(t.Nullable3, t.Nullable1, t.Nullable2, t.Id), + Coalesce(t.Nullable3, t.Nullable2, t.Nullable1, t.Id), + t.Id, + Coalesce(t.Nullable1, t.Id), + Coalesce(t.Nullable1, t.Nullable2, t.Id) +FROM + CoalesceNullableFields t + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- ClickHouse.MySql ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql).sql index 81f26d05427..8f6999edbc8 100644 --- a/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.MySql).sql @@ -58,14 +58,14 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - m_1.Id, + t2.Id, c_1.Id, c_1.Value, t1.Id, t1.Value_1 FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t2 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t2.Id LEFT JOIN ( SELECT sc.Id as Id, @@ -75,7 +75,7 @@ FROM LIMIT 1 ) t1 ON 1=1 ORDER BY - m_1.Id + t2.Id BeforeExecute -- ClickHouse.MySql ClickHouse diff --git a/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql).sql index b3058232710..44c38bbd5e1 100644 --- a/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.MySql).sql @@ -61,8 +61,8 @@ SELECT c_1.Id, c_1.Value FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t1 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t1.Id ORDER BY c_1.Id DESC diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.MySql).sql new file mode 100644 index 00000000000..9bb7f6c387b --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.MySql).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Coalesce(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.MySql).sql new file mode 100644 index 00000000000..e810a2dad36 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.MySql).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql).sql index 491686b69ee..e810a2dad36 100644 --- a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.MySql).sql @@ -2,17 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql).sql index b9d0a538e37..f0c8efce5e0 100644 --- a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.MySql).sql @@ -2,14 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.MySql).sql new file mode 100644 index 00000000000..1172cd768dd --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.MySql).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.MySql).sql new file mode 100644 index 00000000000..8e497743655 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.MySql).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.MySql).sql new file mode 100644 index 00000000000..f0c8efce5e0 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.MySql).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.MySql).sql new file mode 100644 index 00000000000..761e2566c36 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.MySql).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.MySql).sql new file mode 100644 index 00000000000..491686b69ee --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.MySql).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.MySql).sql new file mode 100644 index 00000000000..b9d0a538e37 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.MySql).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.MySql ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,False).sql b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,False).sql index 9f585aa30ab..710c0fb21e5 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,False).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,True).sql b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,True).sql index 9f585aa30ab..710c0fb21e5 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,True).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.MySql,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,False).sql b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,False).sql index 65e2273b034..7691b482c49 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,False).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,True).sql b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,True).sql index 65e2273b034..7691b482c49 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,True).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.MySql,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.MySql ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql).sql index 3094d0a8d4e..f4ec22b2fd6 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.MySql).sql @@ -2,10 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID as ParentID, @@ -24,9 +24,9 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID LIMIT 10 diff --git a/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql).sql index dd9cf8b037c..cfa96572cb2 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.MySql).sql @@ -2,10 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql).sql index f68e2fae093..a54bdbd325b 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.MySql).sql @@ -2,10 +2,10 @@ -- ClickHouse.MySql ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10, 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,2).sql b/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,2).sql index f4d1c1e9056..99f87db07db 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,2).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,2).sql @@ -60,7 +60,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - m_1.ID, + m_1.Key_1, d.id, d.id2, d.id3, @@ -69,7 +69,7 @@ SELECT FROM ( SELECT - x.id as ID + x.id as Key_1 FROM T1 x LEFT JOIN T2 order_1 ON x.id = order_1.id AND order_1.id2 = 2 @@ -81,7 +81,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN T1 d ON m_1.ID = d.id + INNER JOIN T1 d ON m_1.Key_1 = d.id LEFT JOIN T2 order_2 ON d.id = order_2.id AND order_2.id2 = 2 WHERE d.id2 = 2 diff --git a/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,85).sql b/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,85).sql index 48ec930b439..28304bd6233 100644 --- a/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,85).sql +++ b/ClickHouse.MySql/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.MySql,85).sql @@ -60,7 +60,7 @@ BeforeExecute -- ClickHouse.MySql ClickHouse SELECT - m_1.ID, + m_1.Key_1, d.id, d.id2, d.id3, @@ -69,7 +69,7 @@ SELECT FROM ( SELECT - x.id as ID + x.id as Key_1 FROM T1 x LEFT JOIN T2 order_1 ON x.id = order_1.id AND order_1.id2 = 85 @@ -81,7 +81,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN T1 d ON m_1.ID = d.id + INNER JOIN T1 d ON m_1.Key_1 = d.id LEFT JOIN T2 order_2 ON d.id = order_2.id AND order_2.id2 = 85 WHERE d.id2 = 85 diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica.LinqService).sql index a4ba597ccbe..ce1d697c82c 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) + WHEN t1.ParentID_1 IS NULL THEN 0 + ELSE t1.ParentID_1 END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - Parent p + ( + SELECT + p.ParentID as ParentID, + ( + SELECT + c_1.ParentID + FROM + Child c_1 + WHERE + c_1.ParentID > 0 + ORDER BY + c_1.ParentID + LIMIT 1 + ) as ParentID_1 + FROM + Parent p + ) t1 ORDER BY - p.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica.LinqService,False).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica.LinqService,False).sql index 46c91c5c864..5e344df56c1 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica.LinqService,False).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica.LinqService,False).sql @@ -85,22 +85,24 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue FROM - Issue4167Table g_1 -WHERE - g_1.Value = '000001' -GROUP BY - g_1.Value, - g_1.EnumValue + ( + SELECT + CASE + WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue + ELSE 0 + END as EnumValue + FROM + Issue4167Table g_1 + WHERE + g_1.Value = '000001' + GROUP BY + g_1.Value, + g_1.EnumValue + ) t1 ORDER BY - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica.LinqService).sql index 87908563edf..2c8e433c7ae 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica.LinqService).sql @@ -66,10 +66,10 @@ SELECT c4.ChildID, c4.ParentID FROM - Child p - INNER JOIN Child c4 ON c4.ParentID = p.ParentID + Child c_1 + INNER JOIN Child c4 ON c4.ParentID = c_1.ParentID WHERE - p.ParentID > 1 AND c4.ParentID % 2 = 0 + c_1.ParentID > 1 AND c4.ParentID % 2 = 0 ORDER BY c4.ChildID, c4.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica.LinqService).sql index 64032ca3240..f48906e1032 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addDays(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica.LinqService).sql index 3a4a75b47cd..3899657fc87 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addHours(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica.LinqService).sql index 1a034adb20f..fa2f25a788d 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM fromUnixTimestamp64Nano(toUnixTimestamp64Nano(x.TransactionDate) + toInt64(toFloat64(-1000000))) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica.LinqService).sql index e4e1df334f5..aebe4153b52 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addMinutes(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica.LinqService).sql index 5d36167c96c..d26a8926dc8 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addMonths(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica.LinqService).sql index b1380d8b98d..4349db2f037 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addSeconds(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica.LinqService).sql index 719303357e6..c9e616c8ef3 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM addYears(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica.LinqService).sql index 7d217a356a3..f69d1f610c8 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDate32(x.TransactionDate) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica.LinqService).sql index 7236f980eae..54e1d3f1f8a 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.DayOfWeek, + t1.DayOfWeek, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfWeek(addDays(x.TransactionDate, 1)) - 1 as DayOfWeek FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfWeek + t1.DayOfWeek ORDER BY - x_1.DayOfWeek + t1.DayOfWeek BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica.LinqService).sql index 4246adfb9aa..d3149b0c81d 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.DayOfYear, + t1.DayOfYear, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfYear(x.TransactionDate) as DayOfYear FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfYear + t1.DayOfYear ORDER BY - x_1.DayOfYear + t1.DayOfYear BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica.LinqService).sql index b899fe0d56d..79dcd6ab68c 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Day_1, + t1.Day_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toDayOfMonth(x.TransactionDate) as Day_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Day_1 + t1.Day_1 ORDER BY - x_1.Day_1 + t1.Day_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica.LinqService).sql index 581fdb64c7f..3ef4aef7c0a 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Hour_1, + t1.Hour_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toHour(x.TransactionDate) as Hour_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Hour_1 + t1.Hour_1 ORDER BY - x_1.Hour_1 + t1.Hour_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica.LinqService).sql index a025a863f7a..68a00a301bd 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Millisecond, + t1.Millisecond, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toUnixTimestamp64Milli(x.TransactionDate) % 1000 as Millisecond FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Millisecond + t1.Millisecond ORDER BY - x_1.Millisecond + t1.Millisecond BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica.LinqService).sql index 2c37b5035eb..537e65884a3 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Minute_1, + t1.Minute_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toMinute(x.TransactionDate) as Minute_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Minute_1 + t1.Minute_1 ORDER BY - x_1.Minute_1 + t1.Minute_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica.LinqService).sql index b3d5a993f10..8a5be33b13a 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Month_1, + t1.Month_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toMonth(x.TransactionDate) as Month_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Month_1 + t1.Month_1 ORDER BY - x_1.Month_1 + t1.Month_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica.LinqService).sql index e3741f4f269..c0f1184bffc 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Second_1, + t1.Second_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toSecond(x.TransactionDate) as Second_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Second_1 + t1.Second_1 ORDER BY - x_1.Second_1 + t1.Second_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica.LinqService).sql index 43fa7419471..7d1d0f2adfe 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toInt64((toUnixTimestamp64Nano(toDateTime64(x.TransactionDate, 7)) - toUnixTimestamp64Nano(toDateTime64(toDate32(x.TransactionDate), 7))) / 100) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica.LinqService).sql index 198cccd1f02..559033ad5ac 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica.LinqService).sql @@ -230,7 +230,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Year_1, + t1.Year_1, COUNT(*) FROM ( @@ -238,11 +238,11 @@ FROM toYear(x.TransactionDate) as Year_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Year_1 + t1.Year_1 ORDER BY - x_1.Year_1 + t1.Year_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica.LinqService).sql index 263dfba05ce..e23e8e341fe 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica.LinqService).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d.ParentID as ParentID, - d.ChildID as ChildID + d.ChildID as ChildID, + d.ParentID as ParentID FROM Child d WHERE diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,1).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,1).sql index 31a685fd6f8..57cb2328261 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,1).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,1).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 2 AS PersonID UNION ALL - SELECT 'Doe', 3) n ON p.PersonID = n.PersonID + SELECT 'Doe', 3) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,2).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,2).sql index 65bcd17a911..d98afeee3d8 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,2).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica.LinqService,2).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 3 AS PersonID UNION ALL - SELECT 'Doe', 4) n ON p.PersonID = n.PersonID + SELECT 'Doe', 4) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica.LinqService).sql index 5c2d1f45ec9..4c6743937a5 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - concat(t1.FirstName, ' ', t1.LastName) + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,14).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,14).sql index 4e53f117753..0b9a6877041 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,14).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,15).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,15).sql index f015d9cb641..06cf330119e 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,15).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,14).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,14).sql index b279a4063af..2acea53abdd 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,14).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,15).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,15).sql index b56d37eeb2a..81ca41f6e71 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,15).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,14).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,14).sql index 647dc8ee4ae..2b85570c26f 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,14).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,15).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,15).sql index 1b9264e3a09..32845332455 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,15).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,14).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,14).sql index b279a4063af..2acea53abdd 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,14).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,14).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,15).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,15).sql index b56d37eeb2a..81ca41f6e71 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,15).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica.LinqService,15).sql @@ -300,10 +300,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica.LinqService).sql index 06153b0b818..905008f835d 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2.ParentID, a_2.Value1, - z_1.ParentID, - z_1.Value1, + z_2.ParentID, + z_2.Value1, y.ParentID, y.Value1, a.ParentID, @@ -19,6 +19,13 @@ FROM LEFT JOIN Parent y ON a_2.ParentID = y.ParentID LEFT JOIN Parent a ON a_2.ParentID = a.ParentID LEFT JOIN Parent z ON a_2.ParentID = z.ParentID - LEFT JOIN Parent z_1 ON a_2.ParentID = Coalesce(z_1.Value1, 1) + LEFT JOIN ( + SELECT + z_1.ParentID as ParentID, + z_1.Value1 as Value1, + Coalesce(z_1.Value1, 1) as c1 + FROM + Parent z_1 + ) z_2 ON a_2.ParentID = z_2.c1 LEFT JOIN Parent a_1 ON a_2.ParentID = a_1.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica.LinqService).sql index f109c4fc9ec..01ea9df2869 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica.LinqService).sql index ede604f569c..911e22f027b 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> 1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql index c8f90a015c3..725ac6db2f3 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica.LinqService).sql index 04d1dfadd50..e36145ffd4e 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -14,7 +14,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> 2 AND left2.ParentID <> 1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql index fdaee4a21d4..218d3c7689c 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica.LinqService).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica.LinqService).sql index f1e1e6583c7..6cd7e5750d9 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica.LinqService).sql @@ -355,13 +355,13 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1) + maxOrNull(x.OrderData1) LIMIT 0, 3 BeforeExecute @@ -377,13 +377,13 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - minOrNull(g_1.OrderData1) DESC + minOrNull(x.OrderData1) DESC LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica.LinqService).sql index 164d2c82f5d..8b411bb53e6 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica.LinqService).sql @@ -355,13 +355,13 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1 % 3) + maxOrNull(x.OrderData1 % 3) LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica.LinqService).sql index ddfcb8f0417..b201138a32b 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID DESC + ch.ChildID % 2, + ch.ChildID DESC diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica.LinqService).sql index 928407188fe..a5fd992efb7 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - x.ChildID % 2, - x.ChildID + x.ChildID, + x.ChildID % 2 diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica.LinqService).sql index 928407188fe..2cc4835944f 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID + ch.ChildID % 2, + ch.ChildID diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica.LinqService).sql index eff8432c51c..066fe0e3516 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica.LinqService).sql @@ -2,11 +2,11 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2 DESC, - x.ChildID DESC + ch.ChildID % 2 DESC, + ch.ChildID DESC diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica.LinqService).sql index c77ac3e8713..3453b558109 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica.LinqService).sql @@ -2,17 +2,21 @@ -- ClickHouse.Octonica ClickHouse SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN true + ELSE false + END as flag, + t1.PersonID as ID, + t1.LastName as LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.flag diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..f561548646e --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,123 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int32, + Nullable1 Nullable(Int32), + Nullable2 Nullable(Int32), + Nullable3 Nullable(Int32), + + PRIMARY KEY (Id) +) +ENGINE = MergeTree() +ORDER BY Id + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 1, + 10, + NULL, + NULL +) + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 2, + NULL, + 20, + NULL +) + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 3, + NULL, + NULL, + 30 +) + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + 4, + NULL, + NULL, + NULL +) + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + Coalesce(t.Nullable1, t.Nullable2, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable1, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable3, t.Nullable1, t.Id), + Coalesce(t.Nullable3, t.Nullable1, t.Nullable2, t.Id), + Coalesce(t.Nullable3, t.Nullable2, t.Nullable1, t.Id), + t.Id, + Coalesce(t.Nullable1, t.Id), + Coalesce(t.Nullable1, t.Nullable2, t.Id) +FROM + CoalesceNullableFields t + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica.LinqService).sql index 4bcd9964d81..16dd2a2236a 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica.LinqService).sql @@ -77,14 +77,14 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - m_1.Id, + t2.Id, c_1.Id, c_1.Value, t1.Id, t1.Value_1 FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t2 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t2.Id LEFT JOIN ( SELECT sc.Id as Id, @@ -94,7 +94,7 @@ FROM LIMIT 1 ) t1 ON 1=1 ORDER BY - m_1.Id + t2.Id BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica.LinqService).sql index 3d027cfa98e..b927f93ed84 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica.LinqService).sql @@ -80,8 +80,8 @@ SELECT c_1.Id, c_1.Value FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t1 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t1.Id ORDER BY c_1.Id DESC diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..07b8a90ac2d --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Coalesce(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..563f3404d32 --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica.LinqService).sql index 0b4b21e9bb6..563f3404d32 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica.LinqService).sql @@ -2,17 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica.LinqService).sql index b940b36cf60..e7ec613c0e1 100644 --- a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica.LinqService).sql @@ -2,14 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..88e66e30081 --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..5f33ba3308f --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..e7ec613c0e1 --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..cbdc31bb93a --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..0b4b21e9bb6 --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Octonica.LinqService).sql new file mode 100644 index 00000000000..b940b36cf60 --- /dev/null +++ b/ClickHouse.Octonica.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Octonica.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,False).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,False).sql index 9c4ef793870..131efb1c966 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,False).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,True).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,True).sql index 9c4ef793870..131efb1c966 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,True).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,False).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,False).sql index 06172196ae9..02e18af6c09 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,False).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,True).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,True).sql index 06172196ae9..02e18af6c09 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,True).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica.LinqService).sql index 10473caa83f..1a03701a99e 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID as ParentID, @@ -24,9 +24,9 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID LIMIT 10 diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica.LinqService).sql index 3d677306946..4a4d5003b67 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica.LinqService).sql b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica.LinqService).sql index dc827ed27c3..acefbc41d0b 100644 --- a/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica.LinqService).sql +++ b/ClickHouse.Octonica.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica.LinqService).sql @@ -2,10 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10, 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Octonica/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica).sql index a4ba597ccbe..ce1d697c82c 100644 --- a/ClickHouse.Octonica/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(ClickHouse.Octonica).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - c_1.ParentID - FROM - Child c_1 - WHERE - c_1.ParentID > 0 - ORDER BY - c_1.ParentID - LIMIT 1 - ) + WHEN t1.ParentID_1 IS NULL THEN 0 + ELSE t1.ParentID_1 END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - Parent p + ( + SELECT + p.ParentID as ParentID, + ( + SELECT + c_1.ParentID + FROM + Child c_1 + WHERE + c_1.ParentID > 0 + ORDER BY + c_1.ParentID + LIMIT 1 + ) as ParentID_1 + FROM + Parent p + ) t1 ORDER BY - p.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica,False).sql b/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica,False).sql index 3ec4a3eeec0..7fab1d6a8c5 100644 --- a/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica,False).sql +++ b/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(ClickHouse.Octonica,False).sql @@ -36,22 +36,24 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue FROM - Issue4167Table g_1 -WHERE - g_1.Value = '000001' -GROUP BY - g_1.Value, - g_1.EnumValue + ( + SELECT + CASE + WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue + ELSE 0 + END as EnumValue + FROM + Issue4167Table g_1 + WHERE + g_1.Value = '000001' + GROUP BY + g_1.Value, + g_1.EnumValue + ) t1 ORDER BY - CASE - WHEN g_1.EnumValue IS NOT NULL THEN g_1.EnumValue - ELSE 0 - END + t1.EnumValue BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica).sql index 87908563edf..2c8e433c7ae 100644 --- a/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(ClickHouse.Octonica).sql @@ -66,10 +66,10 @@ SELECT c4.ChildID, c4.ParentID FROM - Child p - INNER JOIN Child c4 ON c4.ParentID = p.ParentID + Child c_1 + INNER JOIN Child c4 ON c4.ParentID = c_1.ParentID WHERE - p.ParentID > 1 AND c4.ParentID % 2 = 0 + c_1.ParentID > 1 AND c4.ParentID % 2 = 0 ORDER BY c4.ChildID, c4.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica).sql index 40d2602e8b0..9a73e8f5e33 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addDays(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica).sql index aae9c81b6b0..9db90f2a8e7 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addHours(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica).sql index 93a5f3eec61..216f3ec89f4 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM fromUnixTimestamp64Nano(toUnixTimestamp64Nano(x.TransactionDate) + toInt64(toFloat64(-1000000))) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica).sql index 91c0bb2b6de..b0fa400faf0 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addMinutes(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica).sql index 1509d2e0adc..1ae2d86685f 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addMonths(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica).sql index ea77f9d25dc..e2d6fc8e0c7 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addSeconds(x.TransactionDate, toFloat64(-1)) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica).sql index 32a060e4d20..39edef7563e 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM addYears(x.TransactionDate, -1) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica).sql index 1e536aa44a6..21c39741452 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDate32(x.TransactionDate) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica).sql index 95250096300..94a2a7766bb 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.DayOfWeek, + t1.DayOfWeek, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfWeek(addDays(x.TransactionDate, 1)) - 1 as DayOfWeek FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfWeek + t1.DayOfWeek ORDER BY - x_1.DayOfWeek + t1.DayOfWeek BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica).sql index 70c46cb2653..0afe5f0306e 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.DayOfYear, + t1.DayOfYear, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfYear(x.TransactionDate) as DayOfYear FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.DayOfYear + t1.DayOfYear ORDER BY - x_1.DayOfYear + t1.DayOfYear BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica).sql index d54ed333e38..7f6cb582e35 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Day_1, + t1.Day_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toDayOfMonth(x.TransactionDate) as Day_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Day_1 + t1.Day_1 ORDER BY - x_1.Day_1 + t1.Day_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica).sql index 9b12a5aa266..b917c527941 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Hour_1, + t1.Hour_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toHour(x.TransactionDate) as Hour_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Hour_1 + t1.Hour_1 ORDER BY - x_1.Hour_1 + t1.Hour_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica).sql index 0da9e62227b..c4ddf90d250 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Millisecond, + t1.Millisecond, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toUnixTimestamp64Milli(x.TransactionDate) % 1000 as Millisecond FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Millisecond + t1.Millisecond ORDER BY - x_1.Millisecond + t1.Millisecond BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica).sql index 23c4d9b5b24..8a647e7ed0b 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Minute_1, + t1.Minute_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toMinute(x.TransactionDate) as Minute_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Minute_1 + t1.Minute_1 ORDER BY - x_1.Minute_1 + t1.Minute_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica).sql index 0be10c730cf..ab10463e8a4 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Month_1, + t1.Month_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toMonth(x.TransactionDate) as Month_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Month_1 + t1.Month_1 ORDER BY - x_1.Month_1 + t1.Month_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica).sql index 6f60f8a4ea1..cb6d54cc2b0 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Second_1, + t1.Second_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toSecond(x.TransactionDate) as Second_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Second_1 + t1.Second_1 ORDER BY - x_1.Second_1 + t1.Second_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica).sql index 389c05653cb..4e6573ad275 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.c1, + t1.c1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toInt64((toUnixTimestamp64Nano(toDateTime64(x.TransactionDate, 7)) - toUnixTimestamp64Nano(toDateTime64(toDate32(x.TransactionDate), 7))) / 100) as c1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.c1 + t1.c1 ORDER BY - x_1.c1 + t1.c1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica).sql index e87d19caf91..1531efeca89 100644 --- a/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(ClickHouse.Octonica).sql @@ -45,7 +45,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - x_1.Year_1, + t1.Year_1, COUNT(*) FROM ( @@ -53,11 +53,11 @@ FROM toYear(x.TransactionDate) as Year_1 FROM Transactions x - ) x_1 + ) t1 GROUP BY - x_1.Year_1 + t1.Year_1 ORDER BY - x_1.Year_1 + t1.Year_1 BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica).sql index 263dfba05ce..e23e8e341fe 100644 --- a/ClickHouse.Octonica/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(ClickHouse.Octonica).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d.ParentID as ParentID, - d.ChildID as ChildID + d.ChildID as ChildID, + d.ParentID as ParentID FROM Child d WHERE diff --git a/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,1).sql b/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,1).sql index 31a685fd6f8..57cb2328261 100644 --- a/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,1).sql +++ b/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,1).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 2 AS PersonID UNION ALL - SELECT 'Doe', 3) n ON p.PersonID = n.PersonID + SELECT 'Doe', 3) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,2).sql b/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,2).sql index 65bcd17a911..d98afeee3d8 100644 --- a/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,2).sql +++ b/ClickHouse.Octonica/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(ClickHouse.Octonica,2).sql @@ -5,11 +5,11 @@ SELECT n.FirstName, n.PersonID FROM - Person p + Person t1 INNER JOIN ( SELECT 'Janet' AS FirstName, 3 AS PersonID UNION ALL - SELECT 'Doe', 4) n ON p.PersonID = n.PersonID + SELECT 'Doe', 4) n ON t1.PersonID = n.PersonID ORDER BY n.PersonID diff --git a/ClickHouse.Octonica/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica).sql index 5c2d1f45ec9..4c6743937a5 100644 --- a/ClickHouse.Octonica/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(ClickHouse.Octonica).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - concat(t1.FirstName, ' ', t1.LastName) + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,14).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,14).sql index 240d456de94..7e81436ffac 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,14).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,15).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,15).sql index cb3091d0dbd..2b9aa376c7f 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,15).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(ClickHouse.Octonica,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= 5 and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,14).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,14).sql index dce1b16dacc..5a97b98a1cb 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,14).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,15).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,15).sql index abb30491b1e..287acf9f555 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,15).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(ClickHouse.Octonica,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,14).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,14).sql index 7c0b1886fec..bbea0f4a8d8 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,14).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,15).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,15).sql index 20366755aee..3edb980b63d 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,15).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(ClickHouse.Octonica,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(1) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,14).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,14).sql index dce1b16dacc..5a97b98a1cb 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,14).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,14).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 14 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,15).sql b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,15).sql index abb30491b1e..287acf9f555 100644 --- a/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,15).sql +++ b/ClickHouse.Octonica/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(ClickHouse.Octonica,15).sql @@ -50,10 +50,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= toInt64(5) and id < 15 - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/ClickHouse.Octonica/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Octonica).sql index 42bd008d975..8dc4f60afe7 100644 --- a/ClickHouse.Octonica/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(ClickHouse.Octonica).sql @@ -3,7 +3,7 @@ SELECT person_1.PersonID, - y_1.PersonID + t1.PersonID FROM ( SELECT @@ -19,8 +19,8 @@ FROM Patient pat WHERE pat.Diagnosis = 'b' - ) y_1 - INNER JOIN Person person_1 ON y_1.PersonID = person_1.PersonID + ) t1 + INNER JOIN Person person_1 ON t1.PersonID = person_1.PersonID ORDER BY person_1.PersonID diff --git a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica).sql index 06153b0b818..905008f835d 100644 --- a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(ClickHouse.Octonica).sql @@ -4,8 +4,8 @@ SELECT a_2.ParentID, a_2.Value1, - z_1.ParentID, - z_1.Value1, + z_2.ParentID, + z_2.Value1, y.ParentID, y.Value1, a.ParentID, @@ -19,6 +19,13 @@ FROM LEFT JOIN Parent y ON a_2.ParentID = y.ParentID LEFT JOIN Parent a ON a_2.ParentID = a.ParentID LEFT JOIN Parent z ON a_2.ParentID = z.ParentID - LEFT JOIN Parent z_1 ON a_2.ParentID = Coalesce(z_1.Value1, 1) + LEFT JOIN ( + SELECT + z_1.ParentID as ParentID, + z_1.Value1 as Value1, + Coalesce(z_1.Value1, 1) as c1 + FROM + Parent z_1 + ) z_2 ON a_2.ParentID = z_2.c1 LEFT JOIN Parent a_1 ON a_2.ParentID = a_1.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica).sql index f109c4fc9ec..01ea9df2869 100644 --- a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(ClickHouse.Octonica).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica).sql index ede604f569c..911e22f027b 100644 --- a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(ClickHouse.Octonica).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -12,7 +12,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> 1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID as ParentID @@ -20,7 +20,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql index c8f90a015c3..725ac6db2f3 100644 --- a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica).sql index 04d1dfadd50..e36145ffd4e 100644 --- a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(ClickHouse.Octonica).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -14,7 +14,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> 2 AND left2.ParentID <> 1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql index fdaee4a21d4..218d3c7689c 100644 --- a/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(ClickHouse.Octonica).sql @@ -2,7 +2,7 @@ -- ClickHouse.Octonica ClickHouse SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -13,7 +13,7 @@ FROM Parent p WHERE p.ParentID <> 1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID as ParentID, @@ -23,7 +23,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> 2 AND right2.ParentID <> 1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica).sql index 62be6353bfb..76259fff468 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(ClickHouse.Octonica).sql @@ -61,13 +61,13 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1) + maxOrNull(x.OrderData1) LIMIT 0, 3 BeforeExecute @@ -83,13 +83,13 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - minOrNull(g_1.OrderData1) DESC + minOrNull(x.OrderData1) DESC LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica).sql index 5f8c7bff65f..88965e85d2c 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(ClickHouse.Octonica).sql @@ -61,13 +61,13 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - maxOrNull(g_1.OrderData1 % 3) + maxOrNull(x.OrderData1 % 3) LIMIT 0, 3 BeforeExecute diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica).sql index ddfcb8f0417..b201138a32b 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(ClickHouse.Octonica).sql @@ -2,11 +2,11 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID DESC + ch.ChildID % 2, + ch.ChildID DESC diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica).sql index 928407188fe..a5fd992efb7 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(ClickHouse.Octonica).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - x.ChildID % 2, - x.ChildID + x.ChildID, + x.ChildID % 2 diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica).sql index 928407188fe..2cc4835944f 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(ClickHouse.Octonica).sql @@ -2,11 +2,11 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2, - x.ChildID + ch.ChildID % 2, + ch.ChildID diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica).sql index eff8432c51c..066fe0e3516 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(ClickHouse.Octonica).sql @@ -2,11 +2,11 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - x.ChildID % 2 DESC, - x.ChildID DESC + ch.ChildID % 2 DESC, + ch.ChildID DESC diff --git a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica).sql index c77ac3e8713..3453b558109 100644 --- a/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(ClickHouse.Octonica).sql @@ -2,17 +2,21 @@ -- ClickHouse.Octonica ClickHouse SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN true + ELSE false + END as flag, + t1.PersonID as ID, + t1.LastName as LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN true - ELSE false - END + t2.flag diff --git a/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..7081190c343 --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(ClickHouse.Octonica).sql @@ -0,0 +1,67 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int32, + Nullable1 Nullable(Int32), + Nullable2 Nullable(Int32), + Nullable3 Nullable(Int32), + + PRIMARY KEY (Id) +) +ENGINE = MergeTree() +ORDER BY Id + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + Coalesce(t.Nullable1, t.Nullable2, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable1, t.Nullable3, t.Id), + Coalesce(t.Nullable2, t.Nullable3, t.Nullable1, t.Id), + Coalesce(t.Nullable3, t.Nullable1, t.Nullable2, t.Id), + Coalesce(t.Nullable3, t.Nullable2, t.Nullable1, t.Id), + t.Id, + Coalesce(t.Nullable1, t.Id), + Coalesce(t.Nullable1, t.Nullable2, t.Id) +FROM + CoalesceNullableFields t + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica).sql index 75a706ffae5..674a60c6b2f 100644 --- a/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(ClickHouse.Octonica).sql @@ -58,14 +58,14 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - m_1.Id, + t2.Id, c_1.Id, c_1.Value, t1.Id, t1.Value_1 FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t2 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t2.Id LEFT JOIN ( SELECT sc.Id as Id, @@ -75,7 +75,7 @@ FROM LIMIT 1 ) t1 ON 1=1 ORDER BY - m_1.Id + t2.Id BeforeExecute -- ClickHouse.Octonica ClickHouse diff --git a/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica).sql index 92a5997f0b3..7312aa51e0e 100644 --- a/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(ClickHouse.Octonica).sql @@ -61,8 +61,8 @@ SELECT c_1.Id, c_1.Value FROM - MainEntityObject m_1 - LEFT JOIN ChildEntityObject c_1 ON c_1.Id = m_1.Id + MainEntityObject t1 + LEFT JOIN ChildEntityObject c_1 ON c_1.Id = t1.Id ORDER BY c_1.Id DESC diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..07b8a90ac2d --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(ClickHouse.Octonica).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Coalesce(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..563f3404d32 --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(ClickHouse.Octonica).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica).sql index 0b4b21e9bb6..563f3404d32 100644 --- a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(ClickHouse.Octonica).sql @@ -2,17 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica).sql index b940b36cf60..e7ec613c0e1 100644 --- a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(ClickHouse.Octonica).sql @@ -2,14 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..88e66e30081 --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(ClickHouse.Octonica).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..5f33ba3308f --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(ClickHouse.Octonica).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..e7ec613c0e1 --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(ClickHouse.Octonica).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..cbdc31bb93a --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(ClickHouse.Octonica).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..0b4b21e9bb6 --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(ClickHouse.Octonica).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Octonica).sql new file mode 100644 index 00000000000..b940b36cf60 --- /dev/null +++ b/ClickHouse.Octonica/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(ClickHouse.Octonica).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- ClickHouse.Octonica ClickHouse + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,False).sql b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,False).sql index 9c4ef793870..131efb1c966 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,False).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,True).sql b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,True).sql index 9c4ef793870..131efb1c966 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,True).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(ClickHouse.Octonica,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(concat(r.FirstName, '1'), NULL) IS NULL + concat(r.FirstName, '1') IS NULL diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,False).sql b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,False).sql index 06172196ae9..02e18af6c09 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,False).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,False).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,True).sql b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,True).sql index 06172196ae9..02e18af6c09 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,True).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(ClickHouse.Octonica,True).sql @@ -10,7 +10,7 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 BeforeExecute -- ClickHouse.Octonica ClickHouse @@ -24,5 +24,5 @@ SELECT FROM Person r WHERE - Coalesce(r.PersonID + 1, 0) = 0 + r.PersonID + 1 = 0 diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica).sql index 10473caa83f..1a03701a99e 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(ClickHouse.Octonica).sql @@ -2,10 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID as ParentID, @@ -24,9 +24,9 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID LIMIT 10 diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica).sql index 3d677306946..4a4d5003b67 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(ClickHouse.Octonica).sql @@ -2,10 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica).sql b/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica).sql index dc827ed27c3..acefbc41d0b 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(ClickHouse.Octonica).sql @@ -2,10 +2,10 @@ -- ClickHouse.Octonica ClickHouse SELECT - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT c_2.ParentID as ParentID, @@ -27,8 +27,8 @@ FROM ORDER BY c_2.ParentID LIMIT 10, 10 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID LIMIT 10 diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,2).sql b/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,2).sql index 351c5c002e1..a2336249ac3 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,2).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,2).sql @@ -60,7 +60,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - m_1.ID, + m_1.Key_1, d.id, d.id2, d.id3, @@ -69,7 +69,7 @@ SELECT FROM ( SELECT - x.id as ID + x.id as Key_1 FROM T1 x LEFT JOIN T2 order_1 ON x.id = order_1.id AND order_1.id2 = 2 @@ -81,7 +81,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN T1 d ON m_1.ID = d.id + INNER JOIN T1 d ON m_1.Key_1 = d.id LEFT JOIN T2 order_2 ON d.id = order_2.id AND order_2.id2 = 2 WHERE d.id2 = 2 diff --git a/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,85).sql b/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,85).sql index f5cfc732527..608cce71413 100644 --- a/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,85).sql +++ b/ClickHouse.Octonica/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(ClickHouse.Octonica,85).sql @@ -60,7 +60,7 @@ BeforeExecute -- ClickHouse.Octonica ClickHouse SELECT - m_1.ID, + m_1.Key_1, d.id, d.id2, d.id3, @@ -69,7 +69,7 @@ SELECT FROM ( SELECT - x.id as ID + x.id as Key_1 FROM T1 x LEFT JOIN T2 order_1 ON x.id = order_1.id AND order_1.id2 = 85 @@ -81,7 +81,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN T1 d ON m_1.ID = d.id + INNER JOIN T1 d ON m_1.Key_1 = d.id LEFT JOIN T2 order_2 ON d.id = order_2.id AND order_2.id2 = 85 WHERE d.id2 = 85 diff --git a/DB2.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2.LinqService).sql index 311100a15c6..ff1e892337c 100644 --- a/DB2.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2.LinqService).sql @@ -3,36 +3,49 @@ SELECT CASE - WHEN "t1"."ParentID" IS NULL THEN 0 - ELSE "t1"."ParentID" + WHEN "t1"."ParentID_1" IS NULL THEN 0 + ELSE "t1"."ParentID_1" END, - "t2"."ParentID", - "t2"."ChildID" + ( + SELECT + "c_2"."ParentID" + FROM + "Child" "c_2" + WHERE + "c_2"."ChildID" > -100 + ORDER BY + "c_2"."ParentID" + FETCH NEXT 1 ROWS ONLY + ), + ( + SELECT + "c_3"."ChildID" + FROM + "Child" "c_3" + WHERE + "c_3"."ChildID" > -100 + ORDER BY + "c_3"."ParentID" + FETCH NEXT 1 ROWS ONLY + ) FROM - "Parent" "p" - LEFT JOIN ( - SELECT - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) "t1" ON 1=1 - LEFT JOIN ( - SELECT - "c_2"."ParentID", - "c_2"."ChildID" - FROM - "Child" "c_2" - WHERE - "c_2"."ChildID" > -100 - ORDER BY - "c_2"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) "t2" ON 1=1 + ( + SELECT + "p"."ParentID", + ( + SELECT + "c_1"."ParentID" + FROM + "Child" "c_1" + WHERE + "c_1"."ParentID" > 0 + ORDER BY + "c_1"."ParentID" + FETCH NEXT 1 ROWS ONLY + ) as "ParentID_1" + FROM + "Parent" "p" + ) "t1" ORDER BY - "p"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2.LinqService,False).sql b/DB2.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2.LinqService,False).sql index 36477d82e84..c85516054f4 100644 --- a/DB2.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2.LinqService,False).sql +++ b/DB2.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2.LinqService,False).sql @@ -115,22 +115,24 @@ BeforeExecute -- DB2 DB2.LUW DB2LUW SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- DB2 DB2.LUW DB2LUW diff --git a/DB2.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2.LinqService).sql index be622fc699b..ec538688f26 100644 --- a/DB2.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2.LinqService).sql @@ -14,8 +14,8 @@ FROM ) "m_1" INNER JOIN ( SELECT DISTINCT - "d"."ParentID", - "d"."ChildID" + "d"."ChildID", + "d"."ParentID" FROM "Child" "d" WHERE diff --git a/DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2.LinqService).sql index 87b51b11166..4f561c32880 100644 --- a/DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2.LinqService).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2.LinqService).sql index b2b954d0906..e6d9cb4ae51 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2.LinqService).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2.LinqService).sql index 832f64cca48..f97b98b70b2 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2.LinqService).sql index baec54693f9..d832c318173 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql index 655d51d3be3..1bb74d2ad83 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql index 66d6e3171df..f5311279311 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql @@ -2,13 +2,13 @@ -- DB2 DB2.LUW DB2LUW SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql index 2ada0a991bd..a1091b3db28 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql index cec3730bac5..f20ec99b357 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql index 4e96b8616a5..a4cbc38e823 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql index f9f5e72322f..09740cbb348 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2.LinqService).sql @@ -2,13 +2,13 @@ -- DB2 DB2.LUW DB2LUW SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql index 0823616ce7f..fb46253db4d 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql index f6646bb9ed0..41c3c3fadb0 100644 --- a/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2.LinqService).sql index 5fe6c61f5e4..11c3b42f021 100644 --- a/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Integer(4) -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET 0 ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -535,13 +535,13 @@ DECLARE @take Integer(4) -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET 0 ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2.LinqService).sql index 0015e4c7b3f..38c0bc06522 100644 --- a/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Integer(4) -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET 0 ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2.LinqService).sql index a2859a23ce4..f3b505011f5 100644 --- a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2.LinqService).sql @@ -2,11 +2,11 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2.LinqService).sql index d970519a113..800ffe19ae4 100644 --- a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2.LinqService).sql index d970519a113..145ec1f6d8b 100644 --- a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2.LinqService).sql @@ -2,11 +2,11 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2.LinqService).sql index 024a6b134a0..4fe2344fe55 100644 --- a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2.LinqService).sql @@ -2,11 +2,11 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2.LinqService).sql index 8b98c27aad1..ab7b10410c3 100644 --- a/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2.LinqService).sql @@ -2,17 +2,21 @@ -- DB2 DB2.LUW DB2LUW SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2"."flag" diff --git a/DB2.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(DB2.LinqService).sql new file mode 100644 index 00000000000..db467e42b3a --- /dev/null +++ b/DB2.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(DB2.LinqService).sql @@ -0,0 +1,164 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '42704' BEGIN END; + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '42710' BEGIN END; + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- DB2 DB2.LUW DB2LUW +DECLARE @Id Integer(4) -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer(4) -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- DB2 DB2.LUW DB2LUW +DECLARE @Id Integer(4) -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer(4) -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- DB2 DB2.LUW DB2LUW +DECLARE @Id Integer(4) -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer(4) -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- DB2 DB2.LUW DB2LUW +DECLARE @Id Integer(4) -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '42704' BEGIN END; + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(DB2.LinqService).sql new file mode 100644 index 00000000000..2ba409ee52e --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(DB2.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(DB2.LinqService).sql new file mode 100644 index 00000000000..c5b9edc56f5 --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2.LinqService).sql index 97af345eb4b..c5b9edc56f5 100644 --- a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2.LinqService).sql @@ -2,17 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2.LinqService).sql index 33cd769e9c0..da755bbfce1 100644 --- a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2.LinqService).sql @@ -2,14 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(DB2.LinqService).sql new file mode 100644 index 00000000000..0334c8c6ac9 --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(DB2.LinqService).sql new file mode 100644 index 00000000000..0e0c2ad083f --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(DB2.LinqService).sql new file mode 100644 index 00000000000..da755bbfce1 --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(DB2.LinqService).sql new file mode 100644 index 00000000000..daa2b6a9085 --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(DB2.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(DB2.LinqService).sql new file mode 100644 index 00000000000..97af345eb4b --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(DB2.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(DB2.LinqService).sql b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(DB2.LinqService).sql new file mode 100644 index 00000000000..33cd769e9c0 --- /dev/null +++ b/DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(DB2.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2.LinqService).sql b/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2.LinqService).sql index d2444294f4a..d4a46c6ce9e 100644 --- a/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2.LinqService).sql @@ -2,10 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -24,9 +24,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT 10 ROWS ONLY diff --git a/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2.LinqService).sql b/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2.LinqService).sql index 5f2ea1d9f0b..4fa6ea7bdae 100644 --- a/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2.LinqService).sql @@ -2,10 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -27,8 +27,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT 10 ROWS ONLY diff --git a/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2.LinqService).sql b/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2.LinqService).sql index 663df1a6ffb..6a91fcc51d8 100644 --- a/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2.LinqService).sql +++ b/DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2.LinqService).sql @@ -2,10 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -27,8 +27,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT 10 ROWS ONLY diff --git a/DB2/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2).sql b/DB2/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2).sql index 311100a15c6..ff1e892337c 100644 --- a/DB2/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2).sql +++ b/DB2/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(DB2).sql @@ -3,36 +3,49 @@ SELECT CASE - WHEN "t1"."ParentID" IS NULL THEN 0 - ELSE "t1"."ParentID" + WHEN "t1"."ParentID_1" IS NULL THEN 0 + ELSE "t1"."ParentID_1" END, - "t2"."ParentID", - "t2"."ChildID" + ( + SELECT + "c_2"."ParentID" + FROM + "Child" "c_2" + WHERE + "c_2"."ChildID" > -100 + ORDER BY + "c_2"."ParentID" + FETCH NEXT 1 ROWS ONLY + ), + ( + SELECT + "c_3"."ChildID" + FROM + "Child" "c_3" + WHERE + "c_3"."ChildID" > -100 + ORDER BY + "c_3"."ParentID" + FETCH NEXT 1 ROWS ONLY + ) FROM - "Parent" "p" - LEFT JOIN ( - SELECT - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) "t1" ON 1=1 - LEFT JOIN ( - SELECT - "c_2"."ParentID", - "c_2"."ChildID" - FROM - "Child" "c_2" - WHERE - "c_2"."ChildID" > -100 - ORDER BY - "c_2"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) "t2" ON 1=1 + ( + SELECT + "p"."ParentID", + ( + SELECT + "c_1"."ParentID" + FROM + "Child" "c_1" + WHERE + "c_1"."ParentID" > 0 + ORDER BY + "c_1"."ParentID" + FETCH NEXT 1 ROWS ONLY + ) as "ParentID_1" + FROM + "Parent" "p" + ) "t1" ORDER BY - "p"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2,False).sql b/DB2/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2,False).sql index 45169198bfc..381d99f93e7 100644 --- a/DB2/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2,False).sql +++ b/DB2/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(DB2,False).sql @@ -42,22 +42,24 @@ BeforeExecute -- DB2 DB2.LUW DB2LUW SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- DB2 DB2.LUW DB2LUW diff --git a/DB2/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2).sql b/DB2/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2).sql index 528f1d794d4..c77ad779c1f 100644 --- a/DB2/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2).sql +++ b/DB2/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(DB2).sql @@ -16,8 +16,8 @@ FROM ) "m_1" INNER JOIN ( SELECT DISTINCT - "d"."ParentID", - "d"."ChildID" + "d"."ChildID", + "d"."ParentID" FROM "Child" "d" WHERE diff --git a/DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2).sql b/DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2).sql index 87b51b11166..4f561c32880 100644 --- a/DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2).sql +++ b/DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(DB2).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2).sql index b2b954d0906..e6d9cb4ae51 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(DB2).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2).sql index 832f64cca48..f97b98b70b2 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2).sql index baec54693f9..d832c318173 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2).sql index 655d51d3be3..1bb74d2ad83 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql index 66d6e3171df..f5311279311 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql @@ -2,13 +2,13 @@ -- DB2 DB2.LUW DB2LUW SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql index 2ada0a991bd..a1091b3db28 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2).sql index cec3730bac5..f20ec99b357 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(DB2).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2).sql index 4e96b8616a5..a4cbc38e823 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql index f9f5e72322f..09740cbb348 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(DB2).sql @@ -2,13 +2,13 @@ -- DB2 DB2.LUW DB2LUW SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql index 0823616ce7f..fb46253db4d 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(DB2).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2).sql b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2).sql index f6646bb9ed0..41c3c3fadb0 100644 --- a/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2).sql +++ b/DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(DB2).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2).sql b/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2).sql index ada9c0cd149..38a94c267c1 100644 --- a/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2).sql +++ b/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(DB2).sql @@ -71,13 +71,13 @@ DECLARE @take Integer(4) -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET 0 ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -97,13 +97,13 @@ DECLARE @take Integer(4) -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET 0 ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2).sql b/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2).sql index e606cb41641..74db35944b5 100644 --- a/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2).sql +++ b/DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(DB2).sql @@ -71,13 +71,13 @@ DECLARE @take Integer(4) -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET 0 ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2).sql b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2).sql index a2859a23ce4..f3b505011f5 100644 --- a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2).sql +++ b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(DB2).sql @@ -2,11 +2,11 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2).sql b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2).sql index d970519a113..800ffe19ae4 100644 --- a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2).sql +++ b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(DB2).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2).sql b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2).sql index d970519a113..145ec1f6d8b 100644 --- a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2).sql +++ b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(DB2).sql @@ -2,11 +2,11 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2).sql b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2).sql index 024a6b134a0..4fe2344fe55 100644 --- a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2).sql +++ b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(DB2).sql @@ -2,11 +2,11 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2).sql b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2).sql index 8b98c27aad1..ab7b10410c3 100644 --- a/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2).sql +++ b/DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(DB2).sql @@ -2,17 +2,21 @@ -- DB2 DB2.LUW DB2LUW SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2"."flag" diff --git a/DB2/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(DB2).sql b/DB2/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(DB2).sql new file mode 100644 index 00000000000..29188c8a2c5 --- /dev/null +++ b/DB2/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(DB2).sql @@ -0,0 +1,76 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '42704' BEGIN END; + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '42710' BEGIN END; + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +BEGIN + DECLARE CONTINUE HANDLER FOR SQLSTATE '42704' BEGIN END; + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(DB2).sql new file mode 100644 index 00000000000..2ba409ee52e --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(DB2).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(DB2).sql new file mode 100644 index 00000000000..c5b9edc56f5 --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2).sql index 97af345eb4b..c5b9edc56f5 100644 --- a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2).sql +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(DB2).sql @@ -2,17 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2).sql index 33cd769e9c0..da755bbfce1 100644 --- a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2).sql +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(DB2).sql @@ -2,14 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(DB2).sql new file mode 100644 index 00000000000..0334c8c6ac9 --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(DB2).sql new file mode 100644 index 00000000000..0e0c2ad083f --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(DB2).sql new file mode 100644 index 00000000000..da755bbfce1 --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(DB2).sql new file mode 100644 index 00000000000..daa2b6a9085 --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(DB2).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(DB2).sql new file mode 100644 index 00000000000..97af345eb4b --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(DB2).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(DB2).sql b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(DB2).sql new file mode 100644 index 00000000000..33cd769e9c0 --- /dev/null +++ b/DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(DB2).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- DB2 DB2.LUW DB2LUW + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2).sql b/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2).sql index d2444294f4a..d4a46c6ce9e 100644 --- a/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2).sql +++ b/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(DB2).sql @@ -2,10 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -24,9 +24,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT 10 ROWS ONLY diff --git a/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2).sql b/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2).sql index 5f2ea1d9f0b..4fa6ea7bdae 100644 --- a/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2).sql +++ b/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(DB2).sql @@ -2,10 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -27,8 +27,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT 10 ROWS ONLY diff --git a/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2).sql b/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2).sql index 663df1a6ffb..6a91fcc51d8 100644 --- a/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2).sql +++ b/DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(DB2).sql @@ -2,10 +2,10 @@ -- DB2 DB2.LUW DB2LUW SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -27,8 +27,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT 10 ROWS ONLY diff --git a/Firebird.2.5.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5.LinqService).sql index fd2ba30408a..92b090c5bec 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5.LinqService).sql @@ -3,27 +3,8 @@ SELECT CASE - WHEN ( - SELECT FIRST 1 - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - ) IS NULL - THEN 0 - ELSE ( - SELECT FIRST 1 - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - ) + WHEN "t1"."ParentID_1" IS NULL THEN 0 + ELSE "t1"."ParentID_1" END, ( SELECT FIRST 1 @@ -46,7 +27,22 @@ SELECT "c_3"."ParentID" ) FROM - "Parent" "p" + ( + SELECT + "p"."ParentID", + ( + SELECT FIRST 1 + "c_1"."ParentID" + FROM + "Child" "c_1" + WHERE + "c_1"."ParentID" > 0 + ORDER BY + "c_1"."ParentID" + ) as "ParentID_1" + FROM + "Parent" "p" + ) "t1" ORDER BY - "p"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5.LinqService,False).sql b/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5.LinqService,False).sql index a2ead523f97..8f6b0062b86 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5.LinqService,False).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5.LinqService,False).sql @@ -115,22 +115,24 @@ BeforeExecute -- Firebird.2.5 Firebird SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.2.5 Firebird diff --git a/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5.LinqService).sql index acd0275ee38..8c470c6312e 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5.LinqService).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5.LinqService).sql index f93503779d7..d5148e1baea 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5.LinqService).sql @@ -8,8 +8,8 @@ SELECT FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE @@ -24,8 +24,8 @@ SELECT FROM ( SELECT DISTINCT - "a_Children_1"."ParentID", - "a_Children_1"."ChildID" + "a_Children_1"."ChildID", + "a_Children_1"."ParentID" FROM "Child" "a_Children_1" WHERE diff --git a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,1).sql b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,1).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,1).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,1).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,2).sql b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,2).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,2).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5.LinqService,2).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,1).sql b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,1).sql index a1d72ec85be..a2b66596f5f 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,1).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,2).sql b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,2).sql index b45018a6a9f..620359ce6ec 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,2).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,1).sql b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,1).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,1).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,1).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,2).sql b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,2).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,2).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5.LinqService,2).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5.LinqService).sql index 4b7db8ea22b..8ab1b4cae2c 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5.LinqService).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,14).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,14).sql index 0efa31dc382..197d59e7c2e 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,14).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,15).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,15).sql index 766fff890ee..e0081c65ac4 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,15).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,14).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,14).sql index fb0879b1c84..7dc06448024 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,14).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,15).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,15).sql index 3213711f57d..0ffc3c6ac95 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,15).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,14).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,14).sql index cd5f2d8c100..f96c599e56a 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,14).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,15).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,15).sql index d58240643dc..8ff3e3d6c91 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,15).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,14).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,14).sql index c74d77a0bc9..3dfeee43607 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,14).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,15).sql b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,15).sql index f27aabf3ab9..9349d7a57d5 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,15).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5.LinqService).sql index 57e725920ff..a09cb74d644 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5.LinqService).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5.LinqService).sql index b8e1032b49e..b24ddb2432e 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5.LinqService).sql index eab36a36daa..88e36ebc379 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql index d44c2c7d40a..224f5a65c05 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql index 11045d3558e..1f6712e0829 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.2.5 Firebird SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql index 33d87a1a95b..794f38bfb04 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql index d253d6a6fce..edcb597c88a 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql index b7ceb1abfb5..7fdf4ab03e0 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql index bbb595b04fe..78f88a70625 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.2.5 Firebird SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql index 55dcbded1b1..72fc775761f 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql index c98e10eaf8b..c327b911955 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5.LinqService).sql index 28f06bf26e6..b4cb587e436 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5.LinqService).sql @@ -512,13 +512,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT FIRST @take SKIP @skip - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") BeforeExecute -- Firebird.2.5 Firebird @@ -540,13 +540,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT FIRST @take SKIP @skip - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC BeforeExecute -- Firebird.2.5 Firebird diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5.LinqService).sql index acff5a51f86..4f1fa47a081 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5.LinqService).sql @@ -512,13 +512,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT FIRST @take SKIP @skip - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) BeforeExecute -- Firebird.2.5 Firebird diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5.LinqService).sql index 8e99741e148..3cf276b66c9 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.2.5 Firebird SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5.LinqService).sql index 871ec5fc0d6..9f907dc577c 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5.LinqService).sql index 871ec5fc0d6..a63120d4cff 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.2.5 Firebird SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5.LinqService).sql index 42a38d1bc8f..c7362e5516e 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.2.5 Firebird SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5.LinqService).sql index 892a8617428..010e5486192 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5.LinqService).sql @@ -2,17 +2,21 @@ -- Firebird.2.5 Firebird SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN '1' - ELSE '0' - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN '1' + ELSE '0' + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN '1' - ELSE '0' - END + "t2"."flag" diff --git a/Firebird.2.5.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..3922ecf71df --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.2.5.LinqService).sql @@ -0,0 +1,164 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.2.5 Firebird + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.2.5 Firebird +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.2.5 Firebird +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.2.5 Firebird +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.2.5 Firebird +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.2.5 Firebird + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..edcdd945234 --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.2.5.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..2d2efdf21d4 --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.2.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5.LinqService).sql index 9736ecdb4bb..2d2efdf21d4 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5.LinqService).sql @@ -2,17 +2,10 @@ -- Firebird.2.5 Firebird SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5.LinqService).sql index 6f82aab3a1c..9bcc6512ee8 100644 --- a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5.LinqService).sql @@ -2,14 +2,10 @@ -- Firebird.2.5 Firebird SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..887e48dfe2f --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.2.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..a1593ab03b6 --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.2.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..9bcc6512ee8 --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.2.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..1cf472a9941 --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.2.5.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..9736ecdb4bb --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.2.5.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.2.5.LinqService).sql new file mode 100644 index 00000000000..6f82aab3a1c --- /dev/null +++ b/Firebird.2.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.2.5.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5.LinqService).sql index 8da48f16bb7..5f6ab7a5f52 100644 --- a/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT FIRST @take - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,8 +26,8 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" diff --git a/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5.LinqService).sql index 8afe698fde8..1f1084c8a83 100644 --- a/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT FIRST @take - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT FIRST 10 "c_2"."ParentID", @@ -28,7 +28,7 @@ FROM ) "c_2" ORDER BY "c_2"."ParentID" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" diff --git a/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5.LinqService).sql b/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5.LinqService).sql index e8c2c971832..462f2ddc29f 100644 --- a/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5.LinqService).sql +++ b/Firebird.2.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT FIRST @take - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT FIRST 10 SKIP 10 "c_2"."ParentID", @@ -28,7 +28,7 @@ FROM ) "c_2" ORDER BY "c_2"."ParentID" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5).sql index fd2ba30408a..92b090c5bec 100644 --- a/Firebird.2.5/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.2.5).sql @@ -3,27 +3,8 @@ SELECT CASE - WHEN ( - SELECT FIRST 1 - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - ) IS NULL - THEN 0 - ELSE ( - SELECT FIRST 1 - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - ) + WHEN "t1"."ParentID_1" IS NULL THEN 0 + ELSE "t1"."ParentID_1" END, ( SELECT FIRST 1 @@ -46,7 +27,22 @@ SELECT "c_3"."ParentID" ) FROM - "Parent" "p" + ( + SELECT + "p"."ParentID", + ( + SELECT FIRST 1 + "c_1"."ParentID" + FROM + "Child" "c_1" + WHERE + "c_1"."ParentID" > 0 + ORDER BY + "c_1"."ParentID" + ) as "ParentID_1" + FROM + "Parent" "p" + ) "t1" ORDER BY - "p"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5,False).sql b/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5,False).sql index ff0efb19e5c..12fb5677536 100644 --- a/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5,False).sql +++ b/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.2.5,False).sql @@ -41,22 +41,24 @@ BeforeExecute -- Firebird.2.5 Firebird SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.2.5 Firebird diff --git a/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5).sql index acd0275ee38..8c470c6312e 100644 --- a/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.2.5).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5).sql index f93503779d7..d5148e1baea 100644 --- a/Firebird.2.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.2.5).sql @@ -8,8 +8,8 @@ SELECT FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE @@ -24,8 +24,8 @@ SELECT FROM ( SELECT DISTINCT - "a_Children_1"."ParentID", - "a_Children_1"."ChildID" + "a_Children_1"."ChildID", + "a_Children_1"."ParentID" FROM "Child" "a_Children_1" WHERE diff --git a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,1).sql b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,1).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,1).sql +++ b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,1).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,2).sql b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,2).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,2).sql +++ b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(Firebird.2.5,2).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,1).sql b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,1).sql index a1d72ec85be..a2b66596f5f 100644 --- a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,1).sql +++ b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,2).sql b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,2).sql index b45018a6a9f..620359ce6ec 100644 --- a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,2).sql +++ b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.2.5,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,1).sql b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,1).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,1).sql +++ b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,1).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,2).sql b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,2).sql index 1ef6b264df3..770ed0910ed 100644 --- a/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,2).sql +++ b/Firebird.2.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(Firebird.2.5,2).sql @@ -3,6 +3,7 @@ SELECT "p"."PersonID", + '1', "p"."FirstName", "p"."LastName", "p"."MiddleName", diff --git a/Firebird.2.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5).sql index 4b7db8ea22b..8ab1b4cae2c 100644 --- a/Firebird.2.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.2.5).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,14).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,14).sql index 59acd143903..c9de9612436 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,14).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,15).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,15).sql index a6932ec2ab0..862465f10d1 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,15).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.2.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,14).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,14).sql index 3a39a9a0082..da143f8e8a6 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,14).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,15).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,15).sql index e5de8594cd9..b123b5a8360 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,15).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.2.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,14).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,14).sql index 680ab2f974c..4c126465565 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,14).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,15).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,15).sql index bd054ff7ede..1b8782c47b4 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,15).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.2.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,14).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,14).sql index 7c20e3a97c2..73ca67a131d 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,14).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,15).sql b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,15).sql index b4149d6aea7..8455cbf33e3 100644 --- a/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,15).sql +++ b/Firebird.2.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.2.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5).sql index 57e725920ff..a09cb74d644 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.2.5).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5).sql index b8e1032b49e..b24ddb2432e 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.2.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5).sql index eab36a36daa..88e36ebc379 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.2.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql index d44c2c7d40a..224f5a65c05 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql index 11045d3558e..1f6712e0829 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql @@ -2,13 +2,13 @@ -- Firebird.2.5 Firebird SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql index 33d87a1a95b..794f38bfb04 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql index d253d6a6fce..edcb597c88a 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql index b7ceb1abfb5..7fdf4ab03e0 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.2.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql index bbb595b04fe..78f88a70625 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.2.5).sql @@ -2,13 +2,13 @@ -- Firebird.2.5 Firebird SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql index 55dcbded1b1..72fc775761f 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.2.5).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql index c98e10eaf8b..c327b911955 100644 --- a/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.2.5).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5).sql index 2f0e2bb2d2e..088059ecbb9 100644 --- a/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.2.5).sql @@ -73,13 +73,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT FIRST @take SKIP @skip - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") BeforeExecute -- Firebird.2.5 Firebird @@ -101,13 +101,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT FIRST @take SKIP @skip - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC BeforeExecute -- Firebird.2.5 Firebird diff --git a/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5).sql index 9b9c6199668..392c0812b8e 100644 --- a/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.2.5).sql @@ -73,13 +73,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT FIRST @take SKIP @skip - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) BeforeExecute -- Firebird.2.5 Firebird diff --git a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5).sql index 8e99741e148..3cf276b66c9 100644 --- a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.2.5).sql @@ -2,11 +2,11 @@ -- Firebird.2.5 Firebird SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5).sql index 871ec5fc0d6..9f907dc577c 100644 --- a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.2.5).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5).sql index 871ec5fc0d6..a63120d4cff 100644 --- a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.2.5).sql @@ -2,11 +2,11 @@ -- Firebird.2.5 Firebird SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5).sql index 42a38d1bc8f..c7362e5516e 100644 --- a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.2.5).sql @@ -2,11 +2,11 @@ -- Firebird.2.5 Firebird SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5).sql index 892a8617428..010e5486192 100644 --- a/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.2.5).sql @@ -2,17 +2,21 @@ -- Firebird.2.5 Firebird SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN '1' - ELSE '0' - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN '1' + ELSE '0' + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN '1' - ELSE '0' - END + "t2"."flag" diff --git a/Firebird.2.5/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.2.5).sql new file mode 100644 index 00000000000..320d69ee76b --- /dev/null +++ b/Firebird.2.5/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.2.5).sql @@ -0,0 +1,75 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.2.5 Firebird + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.2.5 Firebird + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +SELECT 1,10,NULL,NULL FROM rdb$database UNION ALL +SELECT 2,NULL,20,NULL FROM rdb$database UNION ALL +SELECT 3,NULL,NULL,30 FROM rdb$database UNION ALL +SELECT 4,NULL,NULL,NULL FROM rdb$database + +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.2.5 Firebird + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.2.5).sql new file mode 100644 index 00000000000..edcdd945234 --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.2.5).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.2.5).sql new file mode 100644 index 00000000000..2d2efdf21d4 --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.2.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5).sql index 9736ecdb4bb..2d2efdf21d4 100644 --- a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.2.5).sql @@ -2,17 +2,10 @@ -- Firebird.2.5 Firebird SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5).sql index 6f82aab3a1c..9bcc6512ee8 100644 --- a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.2.5).sql @@ -2,14 +2,10 @@ -- Firebird.2.5 Firebird SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.2.5).sql new file mode 100644 index 00000000000..887e48dfe2f --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.2.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.2.5).sql new file mode 100644 index 00000000000..a1593ab03b6 --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.2.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.2.5).sql new file mode 100644 index 00000000000..9bcc6512ee8 --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.2.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.2.5).sql new file mode 100644 index 00000000000..1cf472a9941 --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.2.5).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.2.5).sql new file mode 100644 index 00000000000..9736ecdb4bb --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.2.5).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.2.5).sql b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.2.5).sql new file mode 100644 index 00000000000..6f82aab3a1c --- /dev/null +++ b/Firebird.2.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.2.5).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.2.5 Firebird + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5).sql b/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5).sql index 8da48f16bb7..5f6ab7a5f52 100644 --- a/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.2.5).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT FIRST @take - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,8 +26,8 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" diff --git a/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5).sql b/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5).sql index 8afe698fde8..1f1084c8a83 100644 --- a/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.2.5).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT FIRST @take - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT FIRST 10 "c_2"."ParentID", @@ -28,7 +28,7 @@ FROM ) "c_2" ORDER BY "c_2"."ParentID" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" diff --git a/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5).sql b/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5).sql index e8c2c971832..462f2ddc29f 100644 --- a/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5).sql +++ b/Firebird.2.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.2.5).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT FIRST @take - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT FIRST 10 SKIP 10 "c_2"."ParentID", @@ -28,7 +28,7 @@ FROM ) "c_2" ORDER BY "c_2"."ParentID" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3.LinqService).sql index 78c65ae51eb..814b13356a9 100644 --- a/Firebird.3.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) IS NULL - THEN 0 - ELSE ( - SELECT - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) + WHEN "t1"."ParentID_1" IS NULL THEN 0 + ELSE "t1"."ParentID_1" END, ( SELECT @@ -50,7 +29,23 @@ SELECT FETCH NEXT 1 ROWS ONLY ) FROM - "Parent" "p" + ( + SELECT + "p"."ParentID", + ( + SELECT + "c_1"."ParentID" + FROM + "Child" "c_1" + WHERE + "c_1"."ParentID" > 0 + ORDER BY + "c_1"."ParentID" + FETCH NEXT 1 ROWS ONLY + ) as "ParentID_1" + FROM + "Parent" "p" + ) "t1" ORDER BY - "p"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3.LinqService,False).sql b/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3.LinqService,False).sql index c97c6894b70..97652416e84 100644 --- a/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3.LinqService,False).sql +++ b/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3.LinqService,False).sql @@ -115,22 +115,24 @@ BeforeExecute -- Firebird.3 Firebird3 SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.3 Firebird3 diff --git a/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3.LinqService).sql index 673f0483ed1..be757608362 100644 --- a/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3.LinqService).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3.LinqService).sql index df3da98771f..82000171f88 100644 --- a/Firebird.3.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3.LinqService).sql @@ -14,8 +14,8 @@ FROM ) "m_1" INNER JOIN ( SELECT DISTINCT - "d"."ParentID", - "d"."ChildID" + "d"."ChildID", + "d"."ParentID" FROM "Child" "d" WHERE diff --git a/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,1).sql b/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,1).sql index e3e7a735b33..3ec7f57ae2e 100644 --- a/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,1).sql +++ b/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,2).sql b/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,2).sql index 7856b24141a..761d29ff275 100644 --- a/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,2).sql +++ b/Firebird.3.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.3.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3.LinqService).sql index bb1da34f171..32f7bbed9eb 100644 --- a/Firebird.3.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3.LinqService).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,14).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,14).sql index a1cfac47736..c9cbf86e69f 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,14).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,15).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,15).sql index 901ea95ed06..338825aebc7 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,15).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,14).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,14).sql index 9de348a2a70..127b6468de8 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,14).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,15).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,15).sql index b5764877f85..a88a7ad754a 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,15).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,14).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,14).sql index c186d6bd31a..f2e949289c6 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,14).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,15).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,15).sql index 7181fde43b6..45dc37c1143 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,15).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,14).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,14).sql index 3a65bb1618b..724e7db9e57 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,14).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,15).sql b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,15).sql index 9528498876a..d1ac8c65022 100644 --- a/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,15).sql +++ b/Firebird.3.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3.LinqService).sql index 2da6d72cd26..4ef858fc86d 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3.LinqService).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3.LinqService).sql index 1c65384e3c2..c7026ef3927 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3.LinqService).sql index 4a51aea3832..90338b008e2 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql index a118130520c..08f0bec1f7f 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql index b67afaf4402..ffbe7e67d5e 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.3 Firebird3 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql index a9faf650da0..344e2503e55 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql index 3f59e16ce32..ac8437332a2 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql index 0770848fd18..3c152c30a32 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql index f0f35e1b395..5c05ee75fb8 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.3 Firebird3 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql index 0fb96575ea8..5d01c43c7f2 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql index 1b0a874ee78..ec641e4eb0a 100644 --- a/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3.LinqService).sql index 9dc85f8b860..615cc3e5141 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3.LinqService).sql @@ -513,13 +513,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -543,13 +543,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3.LinqService).sql index 3d22b8abe26..e48d1f76f61 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3.LinqService).sql @@ -513,13 +513,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3.LinqService).sql index 0f9abe75b4e..bcdb67e8ac1 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.3 Firebird3 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3.LinqService).sql index d572a4a0bed..8cc15216067 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3.LinqService).sql index d572a4a0bed..c331f30ba8e 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.3 Firebird3 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3.LinqService).sql index 3a2066cdbc3..0df14c871f7 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.3 Firebird3 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3.LinqService).sql index 1965cd9e624..bf77c34922d 100644 --- a/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3.LinqService).sql @@ -2,17 +2,21 @@ -- Firebird.3 Firebird3 SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN TRUE + ELSE FALSE + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2"."flag" diff --git a/Firebird.3.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..27a6942b6b6 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.3.LinqService).sql @@ -0,0 +1,164 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.3 Firebird3 + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.3 Firebird3 +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.3 Firebird3 +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.3 Firebird3 +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.3 Firebird3 +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.3 Firebird3 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..7a8891232a0 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.3.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..88fa340d8e6 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.3.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3.LinqService).sql index 12ac8dbc593..88fa340d8e6 100644 --- a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3.LinqService).sql @@ -2,17 +2,10 @@ -- Firebird.3 Firebird3 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3.LinqService).sql index f47ec16118d..2ae873074d8 100644 --- a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3.LinqService).sql @@ -2,14 +2,10 @@ -- Firebird.3 Firebird3 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..24578756d5b --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.3.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..1195660e544 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.3.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..2ae873074d8 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.3.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..7a85064ee74 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.3.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..12ac8dbc593 --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.3.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.3.LinqService).sql new file mode 100644 index 00000000000..f47ec16118d --- /dev/null +++ b/Firebird.3.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.3.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3.LinqService).sql index f9f56706fe0..980bd3162e8 100644 --- a/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3.LinqService).sql index c14cdcb8e41..eea13b7d3b6 100644 --- a/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3.LinqService).sql b/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3.LinqService).sql index 4eb58f6f0ac..bf1e4856ef0 100644 --- a/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3.LinqService).sql +++ b/Firebird.3.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.3/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3).sql b/Firebird.3/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3).sql index 78c65ae51eb..814b13356a9 100644 --- a/Firebird.3/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Firebird.3).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) IS NULL - THEN 0 - ELSE ( - SELECT - "c_1"."ParentID" - FROM - "Child" "c_1" - WHERE - "c_1"."ParentID" > 0 - ORDER BY - "c_1"."ParentID" - FETCH NEXT 1 ROWS ONLY - ) + WHEN "t1"."ParentID_1" IS NULL THEN 0 + ELSE "t1"."ParentID_1" END, ( SELECT @@ -50,7 +29,23 @@ SELECT FETCH NEXT 1 ROWS ONLY ) FROM - "Parent" "p" + ( + SELECT + "p"."ParentID", + ( + SELECT + "c_1"."ParentID" + FROM + "Child" "c_1" + WHERE + "c_1"."ParentID" > 0 + ORDER BY + "c_1"."ParentID" + FETCH NEXT 1 ROWS ONLY + ) as "ParentID_1" + FROM + "Parent" "p" + ) "t1" ORDER BY - "p"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3,False).sql b/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3,False).sql index 5dd2a45a301..3473877d14f 100644 --- a/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3,False).sql +++ b/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.3,False).sql @@ -41,22 +41,24 @@ BeforeExecute -- Firebird.3 Firebird3 SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.3 Firebird3 diff --git a/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3).sql b/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3).sql index 673f0483ed1..be757608362 100644 --- a/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.3).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.3/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3).sql b/Firebird.3/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3).sql index 723f0837dae..1d6465b7c68 100644 --- a/Firebird.3/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.3).sql @@ -16,8 +16,8 @@ FROM ) "m_1" INNER JOIN ( SELECT DISTINCT - "d"."ParentID", - "d"."ChildID" + "d"."ChildID", + "d"."ParentID" FROM "Child" "d" WHERE diff --git a/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,1).sql b/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,1).sql index e3e7a735b33..3ec7f57ae2e 100644 --- a/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,1).sql +++ b/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,2).sql b/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,2).sql index 7856b24141a..761d29ff275 100644 --- a/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,2).sql +++ b/Firebird.3/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.3,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.3/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3).sql b/Firebird.3/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3).sql index bb1da34f171..32f7bbed9eb 100644 --- a/Firebird.3/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.3).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,14).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,14).sql index a5a0d627163..fd83e4e9a06 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,14).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,15).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,15).sql index 83f0bad9513..77db3825b5b 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,15).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.3,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,14).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,14).sql index b40838af678..8f77fa3e4f1 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,14).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,15).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,15).sql index 2b8a48db633..18ff8d222de 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,15).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.3,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,14).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,14).sql index e027e2662b9..98a411adc4e 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,14).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,15).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,15).sql index 529f1f375f2..ae49ac8d697 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,15).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.3,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,14).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,14).sql index 450199b9802..488b3b0e393 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,14).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,15).sql b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,15).sql index eb8f320194d..613a8671288 100644 --- a/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,15).sql +++ b/Firebird.3/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.3,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3).sql index 2da6d72cd26..4ef858fc86d 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.3).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3).sql index 1c65384e3c2..c7026ef3927 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.3).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3).sql index 4a51aea3832..90338b008e2 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.3).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql index a118130520c..08f0bec1f7f 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql index b67afaf4402..ffbe7e67d5e 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql @@ -2,13 +2,13 @@ -- Firebird.3 Firebird3 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql index a9faf650da0..344e2503e55 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql index 3f59e16ce32..ac8437332a2 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql index 0770848fd18..3c152c30a32 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.3).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql index f0f35e1b395..5c05ee75fb8 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.3).sql @@ -2,13 +2,13 @@ -- Firebird.3 Firebird3 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql index 0fb96575ea8..5d01c43c7f2 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.3).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql index 1b0a874ee78..ec641e4eb0a 100644 --- a/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.3).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3).sql index 97fd669e4e1..61987ce80f3 100644 --- a/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.3).sql @@ -74,13 +74,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -104,13 +104,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3).sql index 80e7cce4cbb..19efd9539b1 100644 --- a/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.3).sql @@ -74,13 +74,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3).sql index 0f9abe75b4e..bcdb67e8ac1 100644 --- a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.3).sql @@ -2,11 +2,11 @@ -- Firebird.3 Firebird3 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3).sql index d572a4a0bed..8cc15216067 100644 --- a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.3).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3).sql index d572a4a0bed..c331f30ba8e 100644 --- a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.3).sql @@ -2,11 +2,11 @@ -- Firebird.3 Firebird3 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3).sql index 3a2066cdbc3..0df14c871f7 100644 --- a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.3).sql @@ -2,11 +2,11 @@ -- Firebird.3 Firebird3 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3).sql b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3).sql index 1965cd9e624..bf77c34922d 100644 --- a/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.3).sql @@ -2,17 +2,21 @@ -- Firebird.3 Firebird3 SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN TRUE + ELSE FALSE + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2"."flag" diff --git a/Firebird.3/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.3).sql b/Firebird.3/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.3).sql new file mode 100644 index 00000000000..225dfa832fb --- /dev/null +++ b/Firebird.3/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.3).sql @@ -0,0 +1,75 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.3 Firebird3 + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.3 Firebird3 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +SELECT 1,10,NULL,NULL FROM rdb$database UNION ALL +SELECT 2,NULL,20,NULL FROM rdb$database UNION ALL +SELECT 3,NULL,NULL,30 FROM rdb$database UNION ALL +SELECT 4,NULL,NULL,NULL FROM rdb$database + +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.3 Firebird3 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.3).sql new file mode 100644 index 00000000000..7a8891232a0 --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.3).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.3).sql new file mode 100644 index 00000000000..88fa340d8e6 --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.3).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3).sql index 12ac8dbc593..88fa340d8e6 100644 --- a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.3).sql @@ -2,17 +2,10 @@ -- Firebird.3 Firebird3 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3).sql index f47ec16118d..2ae873074d8 100644 --- a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3).sql +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.3).sql @@ -2,14 +2,10 @@ -- Firebird.3 Firebird3 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.3).sql new file mode 100644 index 00000000000..24578756d5b --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.3).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.3).sql new file mode 100644 index 00000000000..1195660e544 --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.3).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.3).sql new file mode 100644 index 00000000000..2ae873074d8 --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.3).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.3).sql new file mode 100644 index 00000000000..7a85064ee74 --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.3).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.3).sql new file mode 100644 index 00000000000..12ac8dbc593 --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.3).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.3).sql b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.3).sql new file mode 100644 index 00000000000..f47ec16118d --- /dev/null +++ b/Firebird.3/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.3).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.3 Firebird3 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3).sql b/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3).sql index f9f56706fe0..980bd3162e8 100644 --- a/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3).sql +++ b/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.3).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3).sql b/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3).sql index c14cdcb8e41..eea13b7d3b6 100644 --- a/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3).sql +++ b/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.3).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3).sql b/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3).sql index 4eb58f6f0ac..bf1e4856ef0 100644 --- a/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3).sql +++ b/Firebird.3/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.3).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4.LinqService,False).sql b/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4.LinqService,False).sql index a0854c6dad4..1b034567a61 100644 --- a/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4.LinqService,False).sql +++ b/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4.LinqService,False).sql @@ -115,22 +115,24 @@ BeforeExecute -- Firebird.4 Firebird4 SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.4 Firebird4 diff --git a/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4.LinqService).sql index 5cf4ac839fb..2841c01283b 100644 --- a/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4.LinqService).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4.LinqService).sql index 0480140b359..37eb1fa1a96 100644 --- a/Firebird.4.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,1).sql b/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,1).sql index f520db5b51c..ffe1f1579aa 100644 --- a/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,1).sql +++ b/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,2).sql b/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,2).sql index 2bbe0d48eac..2bc6360aa93 100644 --- a/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,2).sql +++ b/Firebird.4.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.4.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4.LinqService).sql index b21edd27c86..47db1367f37 100644 --- a/Firebird.4.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4.LinqService).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,14).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,14).sql index 4432b471047..3ecf2b74c51 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,14).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,15).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,15).sql index 59213a60b8a..48258ff24b8 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,15).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,14).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,14).sql index b9918c6c4f3..54e0649b0ff 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,14).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,15).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,15).sql index b07137e6014..ccd8955d74f 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,15).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,14).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,14).sql index fbc9bc40a03..afbcfd859f5 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,14).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,15).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,15).sql index ae34be8bf15..2a0ad44c94c 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,15).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,14).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,14).sql index bb47b2b135e..90d755450d5 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,14).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,15).sql b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,15).sql index 7c708a112e4..90f0a8f2ff1 100644 --- a/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,15).sql +++ b/Firebird.4.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4.LinqService).sql index dc9d2583707..8e4d5e89854 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4.LinqService).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4.LinqService).sql index 86900c974d6..06dbfe07258 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4.LinqService).sql index d18a89eb0b7..f14111395e1 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql index f7d3146c934..31457884f67 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql index de70c5ba211..01370a7b918 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.4 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql index 615721ccc4b..824d9298546 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql index ccb60d71a0c..e64ec72aa0d 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql index b4fc01ca195..4105528392d 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql index 7f54f35c9cd..2edd6df03db 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.4 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql index d50149d8942..9a93fbe8d31 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql index 8ac1c8fc40e..068a6c4aa17 100644 --- a/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4.LinqService).sql index e22d415f184..d22fd3a2613 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4.LinqService).sql @@ -513,13 +513,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -543,13 +543,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4.LinqService).sql index c643b25254f..eaa89f75485 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4.LinqService).sql @@ -513,13 +513,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4.LinqService).sql index c46bc3765ff..b8b81df6709 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.4 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4.LinqService).sql index ee2379f9153..a57c4c726e7 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4.LinqService).sql index ee2379f9153..55d1d04a928 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.4 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4.LinqService).sql index 29170dd29d4..3c46c3f96a6 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.4 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4.LinqService).sql index bdf0cdc764d..c90acd5de62 100644 --- a/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4.LinqService).sql @@ -2,17 +2,21 @@ -- Firebird.4 Firebird4 SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN TRUE + ELSE FALSE + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2"."flag" diff --git a/Firebird.4.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..3c1dc2a2c92 --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.4.LinqService).sql @@ -0,0 +1,164 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.4 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.4 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.4 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.4 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.4 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.4 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..19257f5a11f --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.4.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..5d7f6e781ce --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.4.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4.LinqService).sql index 62570c2d2bb..5d7f6e781ce 100644 --- a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4.LinqService).sql @@ -2,17 +2,10 @@ -- Firebird.4 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4.LinqService).sql index 7004ec6b989..b2bcf915bf3 100644 --- a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4.LinqService).sql @@ -2,14 +2,10 @@ -- Firebird.4 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..bfac2be3f9f --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.4.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..36a6779dec1 --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.4.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..b2bcf915bf3 --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.4.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..63be2d67cbc --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.4.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..62570c2d2bb --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.4.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.4.LinqService).sql new file mode 100644 index 00000000000..7004ec6b989 --- /dev/null +++ b/Firebird.4.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.4.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4.LinqService).sql index 4cfb5e7a83a..e523fed4309 100644 --- a/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4.LinqService).sql index e8802953347..4a832a3cc9a 100644 --- a/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4.LinqService).sql b/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4.LinqService).sql index 02a222852b6..a2012a3b4e4 100644 --- a/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4.LinqService).sql +++ b/Firebird.4.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4,False).sql b/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4,False).sql index cda93057729..f8364eee09c 100644 --- a/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4,False).sql +++ b/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.4,False).sql @@ -41,22 +41,24 @@ BeforeExecute -- Firebird.4 Firebird4 SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.4 Firebird4 diff --git a/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4).sql b/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4).sql index 5cf4ac839fb..2841c01283b 100644 --- a/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.4).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.4/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4).sql b/Firebird.4/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4).sql index 0480140b359..37eb1fa1a96 100644 --- a/Firebird.4/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.4).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,1).sql b/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,1).sql index f520db5b51c..ffe1f1579aa 100644 --- a/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,1).sql +++ b/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,2).sql b/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,2).sql index 2bbe0d48eac..2bc6360aa93 100644 --- a/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,2).sql +++ b/Firebird.4/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.4,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.4/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4).sql b/Firebird.4/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4).sql index b21edd27c86..47db1367f37 100644 --- a/Firebird.4/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.4).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,14).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,14).sql index 0673f5eef0b..9d46a5e1b0c 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,14).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,15).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,15).sql index 0aaefc9d13e..1afddf42e68 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,15).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.4,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,14).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,14).sql index 48b4e7c25a5..4d0068e47fd 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,14).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,15).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,15).sql index e5e19ab5ae5..814e9e66d07 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,15).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.4,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,14).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,14).sql index 612bc0c8184..0e799cf7866 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,14).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,15).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,15).sql index 5d02e6bfe2a..38c76eb5e48 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,15).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.4,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,14).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,14).sql index 4a53def6721..6ef7f353448 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,14).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,15).sql b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,15).sql index e32f1576f69..f929fc2b7b6 100644 --- a/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,15).sql +++ b/Firebird.4/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.4,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4).sql index dc9d2583707..8e4d5e89854 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.4).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4).sql index 86900c974d6..06dbfe07258 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.4).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4).sql index d18a89eb0b7..f14111395e1 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.4).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql index f7d3146c934..31457884f67 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql index de70c5ba211..01370a7b918 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql @@ -2,13 +2,13 @@ -- Firebird.4 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql index 615721ccc4b..824d9298546 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql index ccb60d71a0c..e64ec72aa0d 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql index b4fc01ca195..4105528392d 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.4).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql index 7f54f35c9cd..2edd6df03db 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.4).sql @@ -2,13 +2,13 @@ -- Firebird.4 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql index d50149d8942..9a93fbe8d31 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.4).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql index 8ac1c8fc40e..068a6c4aa17 100644 --- a/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.4).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4).sql index f6bd45536c2..e2e59cf7c23 100644 --- a/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.4).sql @@ -74,13 +74,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -104,13 +104,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4).sql index 1dd2219fa88..edcb5143547 100644 --- a/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.4).sql @@ -74,13 +74,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4).sql index c46bc3765ff..b8b81df6709 100644 --- a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.4).sql @@ -2,11 +2,11 @@ -- Firebird.4 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4).sql index ee2379f9153..a57c4c726e7 100644 --- a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.4).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4).sql index ee2379f9153..55d1d04a928 100644 --- a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.4).sql @@ -2,11 +2,11 @@ -- Firebird.4 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4).sql index 29170dd29d4..3c46c3f96a6 100644 --- a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.4).sql @@ -2,11 +2,11 @@ -- Firebird.4 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4).sql b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4).sql index bdf0cdc764d..c90acd5de62 100644 --- a/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.4).sql @@ -2,17 +2,21 @@ -- Firebird.4 Firebird4 SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN TRUE + ELSE FALSE + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2"."flag" diff --git a/Firebird.4/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.4).sql b/Firebird.4/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.4).sql new file mode 100644 index 00000000000..205cd08ac9c --- /dev/null +++ b/Firebird.4/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.4).sql @@ -0,0 +1,75 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.4 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.4 Firebird4 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +SELECT 1,10,NULL,NULL FROM rdb$database UNION ALL +SELECT 2,NULL,20,NULL FROM rdb$database UNION ALL +SELECT 3,NULL,NULL,30 FROM rdb$database UNION ALL +SELECT 4,NULL,NULL,NULL FROM rdb$database + +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.4 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.4).sql new file mode 100644 index 00000000000..19257f5a11f --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.4).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.4).sql new file mode 100644 index 00000000000..5d7f6e781ce --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.4).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4).sql index 62570c2d2bb..5d7f6e781ce 100644 --- a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.4).sql @@ -2,17 +2,10 @@ -- Firebird.4 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4).sql index 7004ec6b989..b2bcf915bf3 100644 --- a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4).sql +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.4).sql @@ -2,14 +2,10 @@ -- Firebird.4 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.4).sql new file mode 100644 index 00000000000..bfac2be3f9f --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.4).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.4).sql new file mode 100644 index 00000000000..36a6779dec1 --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.4).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.4).sql new file mode 100644 index 00000000000..b2bcf915bf3 --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.4).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.4).sql new file mode 100644 index 00000000000..63be2d67cbc --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.4).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.4).sql new file mode 100644 index 00000000000..62570c2d2bb --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.4).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.4).sql b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.4).sql new file mode 100644 index 00000000000..7004ec6b989 --- /dev/null +++ b/Firebird.4/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.4).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.4 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4).sql b/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4).sql index 4cfb5e7a83a..e523fed4309 100644 --- a/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4).sql +++ b/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.4).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4).sql b/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4).sql index e8802953347..4a832a3cc9a 100644 --- a/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4).sql +++ b/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.4).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4).sql b/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4).sql index 02a222852b6..a2012a3b4e4 100644 --- a/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4).sql +++ b/Firebird.4/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.4).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5.LinqService,False).sql b/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5.LinqService,False).sql index 64460ba453d..ebbb01a6274 100644 --- a/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5.LinqService,False).sql +++ b/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5.LinqService,False).sql @@ -115,22 +115,24 @@ BeforeExecute -- Firebird.5 Firebird4 SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.5 Firebird4 diff --git a/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5.LinqService).sql index 760868d1ff4..c2ad03076df 100644 --- a/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5.LinqService).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5.LinqService).sql index 9b5c5f95ea9..4d22cce298e 100644 --- a/Firebird.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,1).sql b/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,1).sql index d77e4fd1716..9af83fcd8da 100644 --- a/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,1).sql +++ b/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,2).sql b/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,2).sql index 80703b7ca7e..f1a39571ebb 100644 --- a/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,2).sql +++ b/Firebird.5.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5.LinqService).sql index 3bfccee3625..65ecf2dda2b 100644 --- a/Firebird.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5.LinqService).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,14).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,14).sql index 96da085bcc0..e88a92d4e0e 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,14).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,15).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,15).sql index 2afca478db8..df2c730626c 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,15).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,14).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,14).sql index 9b8486a5f55..344d95faa4e 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,14).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,15).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,15).sql index 75d3c874cc7..9ee314b298a 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,15).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,14).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,14).sql index 4ce38febcf3..3b16cf0a699 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,14).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,15).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,15).sql index 36dab9e8414..c2615508f9e 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,15).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,14).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,14).sql index 4137cd9ce0e..828a0dbd749 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,14).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,14).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,15).sql b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,15).sql index 6fce302c488..bb42382ae25 100644 --- a/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,15).sql +++ b/Firebird.5.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5.LinqService,15).sql @@ -391,10 +391,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5.LinqService).sql index 16e0fe7a3d7..8f5cba5f9bb 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5.LinqService).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5.LinqService).sql index 75ce96c64d3..342074d229f 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5.LinqService).sql index 20b2e902028..0ac048d3052 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql index 8052712701f..39a396ed907 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql index 3e11964d97d..16a6c24274d 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.5 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql index 10d2030bfa0..f3c00fa48e3 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql index 59859517f4b..ea9534220f8 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql index 3e277bf8344..ed13c4d278c 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql index b380cbf701f..22bf8ca1f11 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5.LinqService).sql @@ -2,13 +2,13 @@ -- Firebird.5 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql index 23e10e3172a..e3f73c85ca7 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql index 3001555d072..12290ae8b04 100644 --- a/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5.LinqService).sql index eb9dc031590..99379fbc2b0 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5.LinqService).sql @@ -513,13 +513,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -543,13 +543,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5.LinqService).sql index 1fb69af4b04..cc8e0a5f497 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5.LinqService).sql @@ -513,13 +513,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5.LinqService).sql index 6229f6b9999..496a2baa9c3 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.5 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5.LinqService).sql index af43fe2aa84..f8a1eb20ec3 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5.LinqService).sql index af43fe2aa84..6144eade6ee 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.5 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5.LinqService).sql index e7b56d81ff9..3f266894ade 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5.LinqService).sql @@ -2,11 +2,11 @@ -- Firebird.5 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5.LinqService).sql index f27d9eed360..4177218197d 100644 --- a/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5.LinqService).sql @@ -2,17 +2,21 @@ -- Firebird.5 Firebird4 SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN TRUE + ELSE FALSE + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2"."flag" diff --git a/Firebird.5.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..b52f5a21097 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.5.LinqService).sql @@ -0,0 +1,164 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.5 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.5 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.5 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.5 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.5 Firebird4 +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.5 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..be530736d07 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.5.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..8bee712d719 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5.LinqService).sql index 78708f86aae..8bee712d719 100644 --- a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5.LinqService).sql @@ -2,17 +2,10 @@ -- Firebird.5 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5.LinqService).sql index 28a94350ca6..c8680194648 100644 --- a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5.LinqService).sql @@ -2,14 +2,10 @@ -- Firebird.5 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..0eabb341a02 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..0344b561b68 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..c8680194648 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.5.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..ffd3487b9ed --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.5.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..78708f86aae --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.5.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.5.LinqService).sql new file mode 100644 index 00000000000..28a94350ca6 --- /dev/null +++ b/Firebird.5.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.5.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5.LinqService).sql index f62eefc9ce8..6fb6bb1e6d2 100644 --- a/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5.LinqService).sql index baa93e56cf3..0f582a5229a 100644 --- a/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5.LinqService).sql b/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5.LinqService).sql index 3da631e8ba2..fb70a644c16 100644 --- a/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5.LinqService).sql +++ b/Firebird.5.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5,False).sql b/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5,False).sql index 0693ea8aa05..4d17556adbb 100644 --- a/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5,False).sql +++ b/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Firebird.5,False).sql @@ -41,22 +41,24 @@ BeforeExecute -- Firebird.5 Firebird4 SELECT - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" FROM - "Issue4167Table" "g_1" -WHERE - "g_1"."Value" = '000001' -GROUP BY - "g_1"."Value", - "g_1"."EnumValue" + ( + SELECT + CASE + WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" "g_1" + WHERE + "g_1"."Value" = '000001' + GROUP BY + "g_1"."Value", + "g_1"."EnumValue" + ) "t1" ORDER BY - CASE - WHEN "g_1"."EnumValue" IS NOT NULL THEN "g_1"."EnumValue" - ELSE 0 - END + "t1"."EnumValue" BeforeExecute -- Firebird.5 Firebird4 diff --git a/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5).sql b/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5).sql index 760868d1ff4..c2ad03076df 100644 --- a/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Firebird.5).sql @@ -75,10 +75,10 @@ SELECT "c4"."ChildID", "c4"."ParentID" FROM - "Child" "p" - INNER JOIN "Child" "c4" ON "c4"."ParentID" = "p"."ParentID" + "Child" "c_1" + INNER JOIN "Child" "c4" ON "c4"."ParentID" = "c_1"."ParentID" WHERE - "p"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 + "c_1"."ParentID" > 1 AND Mod("c4"."ParentID", 2) = 0 ORDER BY "c4"."ChildID", "c4"."ParentID" diff --git a/Firebird.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5).sql b/Firebird.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5).sql index 9b5c5f95ea9..4d22cce298e 100644 --- a/Firebird.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Firebird.5).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,1).sql b/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,1).sql index d77e4fd1716..9af83fcd8da 100644 --- a/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,1).sql +++ b/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,2).sql b/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,2).sql index 80703b7ca7e..f1a39571ebb 100644 --- a/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,2).sql +++ b/Firebird.5/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Firebird.5,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT CAST('Janet' AS VARCHAR(5)) AS "FirstName", CAST(@ID AS Int) AS "PersonID" FROM rdb$database UNION ALL - SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT CAST('Doe' AS VARCHAR(3)), CAST(@ID_1 AS Int) FROM rdb$database) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/Firebird.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5).sql b/Firebird.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5).sql index 3bfccee3625..65ecf2dda2b 100644 --- a/Firebird.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Firebird.5).sql @@ -27,8 +27,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,14).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,14).sql index 438ad9be5e7..ddb362892a6 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,14).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,15).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,15).sql index 4205110129a..37cb762ae40 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,15).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Firebird.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,14).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,14).sql index 23c9f053ae8..6041b5e9002 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,14).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,15).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,15).sql index 4261d890ae3..d35644cf9a6 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,15).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Firebird.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,14).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,14).sql index 5c512050194..820a64e9523 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,14).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,15).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,15).sql index fb9b6bb9478..deab8ae2404 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,15).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Firebird.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @endId - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,14).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,14).sql index 61fa28fcacc..c140e0a77b6 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,14).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,14).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,15).sql b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,15).sql index a74640af734..af8665cfcaa 100644 --- a/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,15).sql +++ b/Firebird.5/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Firebird.5,15).sql @@ -60,10 +60,10 @@ SELECT "s"."value", "s"."id" FROM - "sample_class" "c_1" + "sample_class" "t1" INNER JOIN ( SELECT * FROM "sample_class" where "id" >= @startId and "id" < @p - ) "s" ON "s"."id" = "c_1"."id" + ) "s" ON "s"."id" = "t1"."id" WHERE "s"."id" > 10 ORDER BY diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5).sql index 16e0fe7a3d7..8f5cba5f9bb 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Firebird.5).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5).sql index 75ce96c64d3..342074d229f 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Firebird.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5).sql index 20b2e902028..0ac048d3052 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Firebird.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> @id1 - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id2 - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql index 8052712701f..39a396ed907 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql index 3e11964d97d..16a6c24274d 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql @@ -2,13 +2,13 @@ -- Firebird.5 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql index 10d2030bfa0..f3c00fa48e3 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" FULL JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql index 59859517f4b..ea9534220f8 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql index 3e277bf8344..ed13c4d278c 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Firebird.5).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> @id2 AND "right2"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql index b380cbf701f..22bf8ca1f11 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Firebird.5).sql @@ -2,13 +2,13 @@ -- Firebird.5 Firebird4 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql index 23e10e3172a..e3f73c85ca7 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Firebird.5).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> @id1 - ) "left_1" + ) "t1" RIGHT JOIN "Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql index 3001555d072..12290ae8b04 100644 --- a/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Firebird.5).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> @id2 AND "left2"."ParentID" <> @id1 - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> @id1 - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5).sql index 0415cf7521c..80a70f0a0b2 100644 --- a/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Firebird.5).sql @@ -74,13 +74,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -104,13 +104,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5).sql index 6df955c593a..dd7f92c5d99 100644 --- a/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Firebird.5).sql @@ -74,13 +74,13 @@ DECLARE @take Integer -- Int32 SET @take = 3 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(Mod("g_1"."OrderData1", 3)) + MAX(Mod("x"."OrderData1", 3)) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5).sql index 6229f6b9999..496a2baa9c3 100644 --- a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Firebird.5).sql @@ -2,11 +2,11 @@ -- Firebird.5 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" DESC + Mod("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5).sql index af43fe2aa84..f8a1eb20ec3 100644 --- a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Firebird.5).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + Mod("x"."ChildID", 2) diff --git a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5).sql index af43fe2aa84..6144eade6ee 100644 --- a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Firebird.5).sql @@ -2,11 +2,11 @@ -- Firebird.5 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2), - "x"."ChildID" + Mod("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5).sql index e7b56d81ff9..3f266894ade 100644 --- a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Firebird.5).sql @@ -2,11 +2,11 @@ -- Firebird.5 Firebird4 SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - Mod("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + Mod("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5).sql b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5).sql index f27d9eed360..4177218197d 100644 --- a/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Firebird.5).sql @@ -2,17 +2,21 @@ -- Firebird.5 Firebird4 SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2".ID, + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN TRUE + ELSE FALSE + END as "flag", + "t1"."PersonID" as ID, + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN TRUE - ELSE FALSE - END + "t2"."flag" diff --git a/Firebird.5/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.5).sql b/Firebird.5/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.5).sql new file mode 100644 index 00000000000..12c61d9f6a3 --- /dev/null +++ b/Firebird.5/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Firebird.5).sql @@ -0,0 +1,75 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + +BeforeExecute +-- Firebird.5 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (NOT EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int, + "Nullable2" Int, + "Nullable3" Int, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +END + +BeforeExecute +-- Firebird.5 Firebird4 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +SELECT 1,10,NULL,NULL FROM rdb$database UNION ALL +SELECT 2,NULL,20,NULL FROM rdb$database UNION ALL +SELECT 3,NULL,NULL,30 FROM rdb$database UNION ALL +SELECT 4,NULL,NULL,NULL FROM rdb$database + +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- Firebird.5 Firebird4 + +EXECUTE BLOCK AS BEGIN + IF (EXISTS(SELECT 1 FROM rdb$relations WHERE rdb$relation_name = 'CoalesceNullableFields')) THEN + EXECUTE STATEMENT 'DROP TABLE "CoalesceNullableFields"'; +END + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.5).sql new file mode 100644 index 00000000000..be530736d07 --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Firebird.5).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.5).sql new file mode 100644 index 00000000000..8bee712d719 --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Firebird.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5).sql index 78708f86aae..8bee712d719 100644 --- a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Firebird.5).sql @@ -2,17 +2,10 @@ -- Firebird.5 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5).sql index 28a94350ca6..c8680194648 100644 --- a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5).sql +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Firebird.5).sql @@ -2,14 +2,10 @@ -- Firebird.5 Firebird4 SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.5).sql new file mode 100644 index 00000000000..0eabb341a02 --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Firebird.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.5).sql new file mode 100644 index 00000000000..0344b561b68 --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Firebird.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.5).sql new file mode 100644 index 00000000000..c8680194648 --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Firebird.5).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.5).sql new file mode 100644 index 00000000000..ffd3487b9ed --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Firebird.5).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.5).sql new file mode 100644 index 00000000000..78708f86aae --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Firebird.5).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.5).sql b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.5).sql new file mode 100644 index 00000000000..28a94350ca6 --- /dev/null +++ b/Firebird.5/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Firebird.5).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Firebird.5 Firebird4 + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5).sql b/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5).sql index f62eefc9ce8..6fb6bb1e6d2 100644 --- a/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5).sql +++ b/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Firebird.5).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT DISTINCT "c_2"."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" "t1" ) "c_2" - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5).sql b/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5).sql index baa93e56cf3..0f582a5229a 100644 --- a/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5).sql +++ b/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Firebird.5).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5).sql b/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5).sql index 3da631e8ba2..fb70a644c16 100644 --- a/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5).sql +++ b/Firebird.5/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Firebird.5).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" FETCH NEXT @take ROWS ONLY diff --git a/Informix.DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2.LinqService).sql index 3572210ab28..2655e54ce5f 100644 --- a/Informix.DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - t1.FirstName || ' ' || t1.LastName + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,14).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,14).sql index 21d27f710f9..1fbf23c0a6b 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,14).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,15).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,15).sql index 020117f1126..4eb0b0ddc36 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,15).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,14).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,14).sql index a5384e4b7de..311d9ca5145 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,14).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,15).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,15).sql index c5c7876db54..95ee4726582 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,15).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,14).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,14).sql index 1507aa700be..f9b9604856c 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,14).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,15).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,15).sql index 16512cb31e5..92946222650 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,15).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,14).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,14).sql index 483f2b39567..35ace8b6e84 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,14).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,15).sql b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,15).sql index 15a4f716e6f..14a60868cf2 100644 --- a/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,15).sql +++ b/Informix.DB2.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2.LinqService).sql index 07e46149f25..3ceebc88b0a 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -16,7 +16,7 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID @@ -24,7 +24,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2.LinqService).sql index c17e1d9987b..dbef6349092 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -16,7 +16,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> @id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID @@ -24,7 +24,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql index 1b96f8ff5e9..d3f00abce5a 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -17,7 +17,7 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> @id2 AND right2.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql index 6797cc38866..3c2e279e211 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql @@ -2,13 +2,13 @@ -- Informix.DB2 Informix SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM - Parent left_1 + Parent t1 FULL JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql index e2008a42211..fbf48fc33c9 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM ( @@ -15,10 +15,10 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 FULL JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql index 7cd93c1e9a3..deb663a25d1 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> @id2 AND left2.ParentID <> @id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql index 75eb20bcef4..3576e2dc9a6 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -17,7 +17,7 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> @id2 AND right2.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql index e9d323a40fa..9fb089448d5 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2.LinqService).sql @@ -2,13 +2,13 @@ -- Informix.DB2 Informix SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM - Parent left_1 + Parent t1 RIGHT JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql index 6c169188a56..7468417e1c8 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM ( @@ -15,10 +15,10 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 RIGHT JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql index 396b65f2421..c3ba076b077 100644 --- a/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> @id2 AND left2.ParentID <> @id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2.LinqService).sql index 1ef989b42d1..712aec3107e 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2.LinqService).sql @@ -496,13 +496,13 @@ BeforeExecute -- Informix.DB2 Informix SELECT SKIP 0 FIRST 3 - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - MAX(g_1.OrderData1) + MAX(x.OrderData1) BeforeExecute -- Informix.DB2 Informix @@ -516,13 +516,13 @@ BeforeExecute -- Informix.DB2 Informix SELECT SKIP 0 FIRST 3 - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - MIN(g_1.OrderData1) DESC + MIN(x.OrderData1) DESC BeforeExecute -- Informix.DB2 Informix diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2.LinqService).sql index 9f9c486db39..621fe574bd1 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2.LinqService).sql @@ -496,13 +496,13 @@ BeforeExecute -- Informix.DB2 Informix SELECT SKIP 0 FIRST 3 - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - MAX(Mod(g_1.OrderData1, 3)) + MAX(Mod(x.OrderData1, 3)) BeforeExecute -- Informix.DB2 Informix diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2.LinqService).sql index de65a60d519..4d3ba73f0c3 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2.LinqService).sql @@ -2,11 +2,11 @@ -- Informix.DB2 Informix SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - Mod(x.ChildID, 2), - x.ChildID DESC + Mod(ch.ChildID, 2), + ch.ChildID DESC diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2.LinqService).sql index 56c609bea9a..fb88d6a67f4 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - Mod(x.ChildID, 2), - x.ChildID + x.ChildID, + Mod(x.ChildID, 2) diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2.LinqService).sql index 56c609bea9a..1dfbe8bb65a 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2.LinqService).sql @@ -2,11 +2,11 @@ -- Informix.DB2 Informix SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - Mod(x.ChildID, 2), - x.ChildID + Mod(ch.ChildID, 2), + ch.ChildID diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2.LinqService).sql index f1ac3228901..f173113ff03 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2.LinqService).sql @@ -2,11 +2,11 @@ -- Informix.DB2 Informix SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - Mod(x.ChildID, 2) DESC, - x.ChildID DESC + Mod(ch.ChildID, 2) DESC, + ch.ChildID DESC diff --git a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2.LinqService).sql index 2b94724b1ae..acc92e112a7 100644 --- a/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2.LinqService).sql @@ -2,17 +2,21 @@ -- Informix.DB2 Informix SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN 't' - ELSE 'f' - END::BOOLEAN + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN 't' + ELSE 'f' + END::BOOLEAN as flag, + t1.PersonID as ID, + t1.LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN 't' - ELSE 'f' - END + t2.flag diff --git a/Informix.DB2.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..023eeff5407 --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Informix.DB2.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- Informix.DB2 Informix + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- Informix.DB2 Informix + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int NOT NULL, + Nullable1 Int NULL, + Nullable2 Int NULL, + Nullable3 Int NULL, + + PRIMARY KEY (Id) +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer(4) -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer(4) -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer(4) -- Int32 +SET @Nullable3 = 30 + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix + +SELECT + Nvl(t.Nullable1, Nvl(t.Nullable2, Nvl(t.Nullable3, t.Id))), + Nvl(t.Nullable2, Nvl(t.Nullable1, Nvl(t.Nullable3, t.Id))), + Nvl(t.Nullable2, Nvl(t.Nullable3, Nvl(t.Nullable1, t.Id))), + Nvl(t.Nullable3, Nvl(t.Nullable1, Nvl(t.Nullable2, t.Id))), + Nvl(t.Nullable3, Nvl(t.Nullable2, Nvl(t.Nullable1, t.Id))), + t.Id, + Nvl(t.Nullable1, t.Id), + Nvl(t.Nullable1, Nvl(t.Nullable2, t.Id)) +FROM + CoalesceNullableFields t + +BeforeExecute +-- Informix.DB2 Informix + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- Informix.DB2 Informix + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..e004680f51c --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Informix.DB2.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Nvl(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..93cc2a3a769 --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Informix.DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2.LinqService).sql index 60a1156669f..93cc2a3a769 100644 --- a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2.LinqService).sql @@ -2,17 +2,10 @@ -- Informix.DB2 Informix SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2.LinqService).sql index 409e5bfb854..70b39cddfc6 100644 --- a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2.LinqService).sql @@ -2,14 +2,10 @@ -- Informix.DB2 Informix SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..2c81bc19c5e --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Informix.DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..643ee175822 --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Informix.DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..70b39cddfc6 --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Informix.DB2.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..d73c7511843 --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Informix.DB2.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..60a1156669f --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Informix.DB2.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Informix.DB2.LinqService).sql new file mode 100644 index 00000000000..409e5bfb854 --- /dev/null +++ b/Informix.DB2.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Informix.DB2.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2.LinqService).sql index d93a256a6ea..15fc99996bd 100644 --- a/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2.LinqService).sql @@ -2,10 +2,10 @@ -- Informix.DB2 Informix SELECT FIRST 10 - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID, @@ -24,8 +24,8 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID diff --git a/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2.LinqService).sql index 9a996115e14..ffe66c6563b 100644 --- a/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2.LinqService).sql @@ -2,10 +2,10 @@ -- Informix.DB2 Informix SELECT FIRST 10 - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT FIRST 10 c_2.ParentID, @@ -26,7 +26,7 @@ FROM ) c_2 ORDER BY c_2.ParentID - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID diff --git a/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2.LinqService).sql b/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2.LinqService).sql index e3115b18cea..d927735422e 100644 --- a/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2.LinqService).sql +++ b/Informix.DB2.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2.LinqService).sql @@ -2,10 +2,10 @@ -- Informix.DB2 Informix SELECT FIRST 10 - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT SKIP 10 FIRST 10 c_2.ParentID, @@ -26,7 +26,7 @@ FROM ) c_2 ORDER BY c_2.ParentID - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID diff --git a/Informix.DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2).sql b/Informix.DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2).sql index 3572210ab28..2655e54ce5f 100644 --- a/Informix.DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Informix.DB2).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1.Id, t1.FirstName, - t1.LastName, - t1.FirstName || ' ' || t1.LastName + t1.LastName FROM Issue2434Table t1 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,14).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,14).sql index 21d27f710f9..1fbf23c0a6b 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,14).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,15).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,15).sql index 020117f1126..4eb0b0ddc36 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,15).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Informix.DB2,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,14).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,14).sql index a5384e4b7de..311d9ca5145 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,14).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,15).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,15).sql index c5c7876db54..95ee4726582 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,15).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Informix.DB2,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,14).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,14).sql index 1507aa700be..f9b9604856c 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,14).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,15).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,15).sql index 16512cb31e5..92946222650 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,15).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Informix.DB2,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,14).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,14).sql index 483f2b39567..35ace8b6e84 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,14).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,14).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,15).sql b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,15).sql index 15a4f716e6f..14a60868cf2 100644 --- a/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,15).sql +++ b/Informix.DB2/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Informix.DB2,15).sql @@ -383,10 +383,10 @@ SELECT s."value", s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= @startId and id < @p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2).sql index 07e46149f25..3ceebc88b0a 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Informix.DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -16,7 +16,7 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID @@ -24,7 +24,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id2 - ) right_2 ON right_2.ParentID = left_1.ParentID + ) right_2 ON right_2.ParentID = t1.ParentID ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2).sql index c17e1d9987b..dbef6349092 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Informix.DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1.ParentID FROM ( @@ -16,7 +16,7 @@ FROM Parent left_1 WHERE left_1.ParentID <> @id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1.ParentID @@ -24,7 +24,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id2 - ) t1 ON t1.ParentID = left_2.left_1 + ) t1 ON t1.ParentID = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql index 1b96f8ff5e9..d3f00abce5a 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -17,7 +17,7 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> @id2 AND right2.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql index 6797cc38866..3c2e279e211 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql @@ -2,13 +2,13 @@ -- Informix.DB2 Informix SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM - Parent left_1 + Parent t1 FULL JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql index e2008a42211..fbf48fc33c9 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM ( @@ -15,10 +15,10 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 FULL JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql index 7cd93c1e9a3..deb663a25d1 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> @id2 AND left2.ParentID <> @id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql index 75eb20bcef4..3576e2dc9a6 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Informix.DB2).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer(4) -- Int32 SET @id2 = 2 SELECT - left_1.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -17,7 +17,7 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 WHERE right_1.ParentID <> @id2 AND right2.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_1.Value1 OR right_2.c1 IS NULL AND left_1.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql index e9d323a40fa..9fb089448d5 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Informix.DB2).sql @@ -2,13 +2,13 @@ -- Informix.DB2 Informix SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM - Parent left_1 + Parent t1 RIGHT JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql index 6c169188a56..7468417e1c8 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Informix.DB2).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_1.ParentID, + t1.ParentID, right_1.ParentID FROM ( @@ -15,10 +15,10 @@ FROM Parent p WHERE p.ParentID <> @id1 - ) left_1 + ) t1 RIGHT JOIN Parent right_1 INNER JOIN Parent right2 ON right_1.Value1 = right2.Value1 + 2 - ON (right_1.Value1 + 2 = left_1.Value1 OR right_1.Value1 IS NULL AND left_1.Value1 IS NULL) + ON (right_1.Value1 + 2 = t1.Value1 OR right_1.Value1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_1.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql index 396b65f2421..c3ba076b077 100644 --- a/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Informix.DB2).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer(4) -- Int32 SET @id1 = 1 SELECT - left_2.ParentID, + t1.ParentID, right_2.ParentID FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN Parent left2 ON left_1.Value1 = left2.Value1 + 2 WHERE left_1.ParentID <> @id2 AND left2.ParentID <> @id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1.ParentID, @@ -27,7 +27,7 @@ FROM Parent right_1 WHERE right_1.ParentID <> @id1 - ) right_2 ON (right_2.c1 = left_2.Value1 OR right_2.c1 IS NULL AND left_2.Value1 IS NULL) + ) right_2 ON (right_2.c1 = t1.Value1 OR right_2.c1 IS NULL AND t1.Value1 IS NULL) ORDER BY - left_2.ParentID + t1.ParentID diff --git a/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2).sql index 1ef989b42d1..712aec3107e 100644 --- a/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Informix.DB2).sql @@ -496,13 +496,13 @@ BeforeExecute -- Informix.DB2 Informix SELECT SKIP 0 FIRST 3 - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - MAX(g_1.OrderData1) + MAX(x.OrderData1) BeforeExecute -- Informix.DB2 Informix @@ -516,13 +516,13 @@ BeforeExecute -- Informix.DB2 Informix SELECT SKIP 0 FIRST 3 - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - MIN(g_1.OrderData1) DESC + MIN(x.OrderData1) DESC BeforeExecute -- Informix.DB2 Informix diff --git a/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2).sql index 9f9c486db39..621fe574bd1 100644 --- a/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Informix.DB2).sql @@ -496,13 +496,13 @@ BeforeExecute -- Informix.DB2 Informix SELECT SKIP 0 FIRST 3 - g_1.DuplicateData + x.DuplicateData FROM - OrderByDistinctData g_1 + OrderByDistinctData x GROUP BY - g_1.DuplicateData + x.DuplicateData ORDER BY - MAX(Mod(g_1.OrderData1, 3)) + MAX(Mod(x.OrderData1, 3)) BeforeExecute -- Informix.DB2 Informix diff --git a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2).sql index de65a60d519..4d3ba73f0c3 100644 --- a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Informix.DB2).sql @@ -2,11 +2,11 @@ -- Informix.DB2 Informix SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - Mod(x.ChildID, 2), - x.ChildID DESC + Mod(ch.ChildID, 2), + ch.ChildID DESC diff --git a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2).sql index 56c609bea9a..fb88d6a67f4 100644 --- a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Informix.DB2).sql @@ -7,6 +7,6 @@ SELECT FROM Child x ORDER BY - Mod(x.ChildID, 2), - x.ChildID + x.ChildID, + Mod(x.ChildID, 2) diff --git a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2).sql index 56c609bea9a..1dfbe8bb65a 100644 --- a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Informix.DB2).sql @@ -2,11 +2,11 @@ -- Informix.DB2 Informix SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - Mod(x.ChildID, 2), - x.ChildID + Mod(ch.ChildID, 2), + ch.ChildID diff --git a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2).sql index f1ac3228901..f173113ff03 100644 --- a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Informix.DB2).sql @@ -2,11 +2,11 @@ -- Informix.DB2 Informix SELECT - x.ParentID, - x.ChildID + ch.ParentID, + ch.ChildID FROM - Child x + Child ch ORDER BY - Mod(x.ChildID, 2) DESC, - x.ChildID DESC + Mod(ch.ChildID, 2) DESC, + ch.ChildID DESC diff --git a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2).sql b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2).sql index 2b94724b1ae..acc92e112a7 100644 --- a/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Informix.DB2).sql @@ -2,17 +2,21 @@ -- Informix.DB2 Informix SELECT - t1.PersonID, - t1.LastName, - CASE - WHEN t1.PersonID IN (1, 3) THEN 't' - ELSE 'f' - END::BOOLEAN + t2.ID, + t2.LastName, + t2.flag FROM - Person t1 + ( + SELECT + CASE + WHEN t1.PersonID IN (1, 3) THEN 't' + ELSE 'f' + END::BOOLEAN as flag, + t1.PersonID as ID, + t1.LastName + FROM + Person t1 + ) t2 ORDER BY - CASE - WHEN t1.PersonID IN (1, 3) THEN 't' - ELSE 'f' - END + t2.flag diff --git a/Informix.DB2/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Informix.DB2).sql b/Informix.DB2/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Informix.DB2).sql new file mode 100644 index 00000000000..023eeff5407 --- /dev/null +++ b/Informix.DB2/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Informix.DB2).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- Informix.DB2 Informix + +DROP TABLE IF EXISTS CoalesceNullableFields + +BeforeExecute +-- Informix.DB2 Informix + +CREATE TABLE IF NOT EXISTS CoalesceNullableFields +( + Id Int NOT NULL, + Nullable1 Int NULL, + Nullable2 Int NULL, + Nullable3 Int NULL, + + PRIMARY KEY (Id) +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer(4) -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer(4) -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer(4) -- Int32 +SET @Nullable3 = 30 + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix +DECLARE @Id Integer(4) -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO CoalesceNullableFields +( + Id, + Nullable1, + Nullable2, + Nullable3 +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Informix.DB2 Informix + +SELECT + Nvl(t.Nullable1, Nvl(t.Nullable2, Nvl(t.Nullable3, t.Id))), + Nvl(t.Nullable2, Nvl(t.Nullable1, Nvl(t.Nullable3, t.Id))), + Nvl(t.Nullable2, Nvl(t.Nullable3, Nvl(t.Nullable1, t.Id))), + Nvl(t.Nullable3, Nvl(t.Nullable1, Nvl(t.Nullable2, t.Id))), + Nvl(t.Nullable3, Nvl(t.Nullable2, Nvl(t.Nullable1, t.Id))), + t.Id, + Nvl(t.Nullable1, t.Id), + Nvl(t.Nullable1, Nvl(t.Nullable2, t.Id)) +FROM + CoalesceNullableFields t + +BeforeExecute +-- Informix.DB2 Informix + +SELECT + t1.Id, + t1.Nullable1, + t1.Nullable2, + t1.Nullable3 +FROM + CoalesceNullableFields t1 + +BeforeExecute +-- Informix.DB2 Informix + +DROP TABLE IF EXISTS CoalesceNullableFields + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Informix.DB2).sql new file mode 100644 index 00000000000..e004680f51c --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Informix.DB2).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND Nvl(p.MiddleName, 'None') = 'None' AND + p.FirstName = 'John' + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Informix.DB2).sql new file mode 100644 index 00000000000..93cc2a3a769 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Informix.DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID = 1 + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2).sql index 60a1156669f..93cc2a3a769 100644 --- a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Informix.DB2).sql @@ -2,17 +2,10 @@ -- Informix.DB2 Informix SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND - p.MiddleName IS NULL AND - p.MiddleName IS NULL AND - p.FirstName IS NOT NULL AND - p.FirstName IS NOT NULL + p.ParentID = 1 diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2).sql index 409e5bfb854..70b39cddfc6 100644 --- a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2).sql +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Informix.DB2).sql @@ -2,14 +2,10 @@ -- Informix.DB2 Informix SELECT - p.FirstName, - p.PersonID, - p.LastName, - p.MiddleName, - p.Gender + p.ParentID, + p.Value1 FROM - Person p + Parent p WHERE - p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND - NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + p.ParentID <> 1 diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Informix.DB2).sql new file mode 100644 index 00000000000..2c81bc19c5e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Informix.DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.Value1 = 1 + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Informix.DB2).sql new file mode 100644 index 00000000000..643ee175822 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Informix.DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + (p.Value1 <> 1 OR p.Value1 IS NULL) + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Informix.DB2).sql new file mode 100644 index 00000000000..70b39cddfc6 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Informix.DB2).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.ParentID, + p.Value1 +FROM + Parent p +WHERE + p.ParentID <> 1 + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Informix.DB2).sql new file mode 100644 index 00000000000..d73c7511843 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Informix.DB2).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND p.MiddleName IS NULL AND p.FirstName IS NOT NULL + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Informix.DB2).sql new file mode 100644 index 00000000000..60a1156669f --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Informix.DB2).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND + p.MiddleName IS NULL AND + p.MiddleName IS NULL AND + p.FirstName IS NOT NULL AND + p.FirstName IS NOT NULL + diff --git a/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Informix.DB2).sql new file mode 100644 index 00000000000..409e5bfb854 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Informix.DB2).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Informix.DB2 Informix + +SELECT + p.FirstName, + p.PersonID, + p.LastName, + p.MiddleName, + p.Gender +FROM + Person p +WHERE + p.PersonID = 1 AND NOT (p.MiddleName IS NOT NULL OR p.PersonID = 2 OR p.MiddleName IS NOT NULL) AND + NOT (p.FirstName IS NULL OR p.PersonID = 2 OR p.FirstName IS NULL) + diff --git a/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2).sql b/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2).sql index d93a256a6ea..15fc99996bd 100644 --- a/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2).sql +++ b/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Informix.DB2).sql @@ -2,10 +2,10 @@ -- Informix.DB2 Informix SELECT FIRST 10 - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT DISTINCT c_2.ParentID, @@ -24,8 +24,8 @@ FROM FROM Child t1 ) c_2 - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID, + t3.ParentID, t2.ChildID diff --git a/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2).sql b/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2).sql index 9a996115e14..ffe66c6563b 100644 --- a/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2).sql +++ b/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Informix.DB2).sql @@ -2,10 +2,10 @@ -- Informix.DB2 Informix SELECT FIRST 10 - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT FIRST 10 c_2.ParentID, @@ -26,7 +26,7 @@ FROM ) c_2 ORDER BY c_2.ParentID - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID diff --git a/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2).sql b/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2).sql index e3115b18cea..d927735422e 100644 --- a/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2).sql +++ b/Informix.DB2/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Informix.DB2).sql @@ -2,10 +2,10 @@ -- Informix.DB2 Informix SELECT FIRST 10 - x.ParentID, + t3.ParentID, t2.ChildID FROM - Parent x + Parent t3 INNER JOIN ( SELECT SKIP 10 FIRST 10 c_2.ParentID, @@ -26,7 +26,7 @@ FROM ) c_2 ORDER BY c_2.ParentID - ) t2 ON t2.ParentID = x.ParentID + ) t2 ON t2.ParentID = t3.ParentID ORDER BY - x.ParentID + t3.ParentID diff --git a/MariaDB.11.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11.LinqService).sql index 60f7870de21..12daf240d66 100644 --- a/MariaDB.11.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) + WHEN `t1`.`ParentID_1` IS NULL THEN 0 + ELSE `t1`.`ParentID_1` END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - `Parent` `p` + ( + SELECT + `p`.`ParentID`, + ( + SELECT + `c_1`.`ParentID` + FROM + `Child` `c_1` + WHERE + `c_1`.`ParentID` > 0 + ORDER BY + `c_1`.`ParentID` + LIMIT 1 + ) as `ParentID_1` + FROM + `Parent` `p` + ) `t1` ORDER BY - `p`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11.LinqService,False).sql b/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11.LinqService,False).sql index 53717a6a689..af2f096fc02 100644 --- a/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11.LinqService,False).sql +++ b/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` FROM - `Issue4167Table` `g_1` -WHERE - `g_1`.`Value` = '000001' -GROUP BY - `g_1`.`Value`, - `g_1`.`EnumValue` + ( + SELECT + CASE + WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` + ELSE 0 + END as `EnumValue` + FROM + `Issue4167Table` `g_1` + WHERE + `g_1`.`Value` = '000001' + GROUP BY + `g_1`.`Value`, + `g_1`.`EnumValue` + ) `t1` ORDER BY - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` BeforeExecute -- MariaDB.11 MariaDB.10.MySqlConnector MySql diff --git a/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11.LinqService).sql index 0085a66b87c..e129c2f7796 100644 --- a/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11.LinqService).sql @@ -67,10 +67,10 @@ SELECT `c4`.`ChildID`, `c4`.`ParentID` FROM - `Child` `p` - INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `p`.`ParentID` + `Child` `c_1` + INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `c_1`.`ParentID` WHERE - `p`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 + `c_1`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 ORDER BY `c4`.`ChildID`, `c4`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11.LinqService).sql index 7ab562409b8..d48f732e470 100644 --- a/MariaDB.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11.LinqService).sql @@ -14,8 +14,8 @@ FROM ) `m_1` INNER JOIN ( SELECT DISTINCT - `d`.`ParentID`, - `d`.`ChildID` + `d`.`ChildID`, + `d`.`ParentID` FROM `Child` `d` WHERE diff --git a/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,1).sql b/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,1).sql index 5f384c05077..9a1669e598c 100644 --- a/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,1).sql +++ b/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,2).sql b/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,2).sql index 30b51eeb0ce..a12121b6003 100644 --- a/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,2).sql +++ b/MariaDB.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MariaDB.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11.LinqService).sql index 78570539fbc..cd066be6051 100644 --- a/MariaDB.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,14).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,14).sql index 4d0da42f21a..7f78e32e83e 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,14).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,15).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,15).sql index eb1333f048f..2c38bbe6049 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,15).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,14).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,14).sql index 189332fa909..41dc28870ba 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,14).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,15).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,15).sql index bff359b8c22..93458a15823 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,15).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,14).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,14).sql index 81057928dc8..b8dfb2a9b94 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,14).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,15).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,15).sql index e525809b7c1..6bfcadd0ca8 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,15).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,14).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,14).sql index 3b0111e600c..86179c23a24 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,14).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,15).sql b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,15).sql index 7a0de246659..096683bca11 100644 --- a/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,15).sql +++ b/MariaDB.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11.LinqService).sql index edf1fe8b5ce..49aa7b722ef 100644 --- a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11.LinqService).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11.LinqService).sql index 4a3a8abbe58..f504bb42174 100644 --- a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11.LinqService).sql index a4501128d0f..fd6e59b42d4 100644 --- a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11.LinqService).sql @@ -2,13 +2,13 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11.LinqService).sql index 0ed411fc5dd..de22b140cc6 100644 --- a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11.LinqService).sql index 3b7ce8c6210..868ab363747 100644 --- a/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11.LinqService).sql index f029612d3fa..f0f0cbb0a6e 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -535,13 +535,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11.LinqService).sql index 1160f03973d..5b587d043b5 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11.LinqService).sql index 2fc1abb416a..f043eabb73f 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11.LinqService).sql @@ -2,11 +2,11 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11.LinqService).sql index 8001dc5dc98..89fbffb59d5 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11.LinqService).sql index 8001dc5dc98..022c8796735 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11.LinqService).sql @@ -2,11 +2,11 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11.LinqService).sql index 418355f2c75..49e636cd15e 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11.LinqService).sql @@ -2,11 +2,11 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11.LinqService).sql index be31bcb44f7..9317401228d 100644 --- a/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11.LinqService).sql @@ -2,17 +2,21 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MariaDB.11.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..ecef6339c10 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MariaDB.11.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..2f8ee903d85 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MariaDB.11.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..9b07ad19053 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MariaDB.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11.LinqService).sql index de6c2b2609e..9b07ad19053 100644 --- a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11.LinqService).sql @@ -2,17 +2,10 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11.LinqService).sql index bb5274e7734..186a2bb00e1 100644 --- a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11.LinqService).sql @@ -2,14 +2,10 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..fb0fd630568 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MariaDB.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..18bdc18e081 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MariaDB.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..186a2bb00e1 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MariaDB.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..29debf43e2b --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MariaDB.11.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..de6c2b2609e --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MariaDB.11.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MariaDB.11.LinqService).sql new file mode 100644 index 00000000000..bb5274e7734 --- /dev/null +++ b/MariaDB.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MariaDB.11.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11.LinqService).sql index 22a21b6b28c..072e05e8273 100644 --- a/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11.LinqService).sql index b93ce5ed5dc..223c3358638 100644 --- a/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11.LinqService).sql b/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11.LinqService).sql index 6f0ea598d55..edf92110c4b 100644 --- a/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11.LinqService).sql +++ b/MariaDB.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MariaDB.11/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11).sql b/MariaDB.11/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11).sql index 60f7870de21..12daf240d66 100644 --- a/MariaDB.11/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MariaDB.11).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) + WHEN `t1`.`ParentID_1` IS NULL THEN 0 + ELSE `t1`.`ParentID_1` END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - `Parent` `p` + ( + SELECT + `p`.`ParentID`, + ( + SELECT + `c_1`.`ParentID` + FROM + `Child` `c_1` + WHERE + `c_1`.`ParentID` > 0 + ORDER BY + `c_1`.`ParentID` + LIMIT 1 + ) as `ParentID_1` + FROM + `Parent` `p` + ) `t1` ORDER BY - `p`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11,False).sql b/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11,False).sql index d11082c6232..8cc16452cbd 100644 --- a/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11,False).sql +++ b/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MariaDB.11,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` FROM - `Issue4167Table` `g_1` -WHERE - `g_1`.`Value` = '000001' -GROUP BY - `g_1`.`Value`, - `g_1`.`EnumValue` + ( + SELECT + CASE + WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` + ELSE 0 + END as `EnumValue` + FROM + `Issue4167Table` `g_1` + WHERE + `g_1`.`Value` = '000001' + GROUP BY + `g_1`.`Value`, + `g_1`.`EnumValue` + ) `t1` ORDER BY - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` BeforeExecute -- MariaDB.11 MariaDB.10.MySqlConnector MySql diff --git a/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11).sql b/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11).sql index 0085a66b87c..e129c2f7796 100644 --- a/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MariaDB.11).sql @@ -67,10 +67,10 @@ SELECT `c4`.`ChildID`, `c4`.`ParentID` FROM - `Child` `p` - INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `p`.`ParentID` + `Child` `c_1` + INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `c_1`.`ParentID` WHERE - `p`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 + `c_1`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 ORDER BY `c4`.`ChildID`, `c4`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11).sql b/MariaDB.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11).sql index 1e040aceccf..bb4e5f9897a 100644 --- a/MariaDB.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MariaDB.11).sql @@ -16,8 +16,8 @@ FROM ) `m_1` INNER JOIN ( SELECT DISTINCT - `d`.`ParentID`, - `d`.`ChildID` + `d`.`ChildID`, + `d`.`ParentID` FROM `Child` `d` WHERE diff --git a/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,1).sql b/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,1).sql index 5f384c05077..9a1669e598c 100644 --- a/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,1).sql +++ b/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,2).sql b/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,2).sql index 30b51eeb0ce..a12121b6003 100644 --- a/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,2).sql +++ b/MariaDB.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MariaDB.11,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MariaDB.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11).sql b/MariaDB.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11).sql index 78570539fbc..cd066be6051 100644 --- a/MariaDB.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MariaDB.11).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,14).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,14).sql index c957da6f7b9..9bcc065ca21 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,14).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,15).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,15).sql index 34efed52fd2..e33fdc0628e 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,15).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MariaDB.11,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,14).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,14).sql index 8584d45aead..96d8ffa5a18 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,14).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,15).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,15).sql index 7f0bbd2b95c..937213684eb 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,15).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MariaDB.11,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,14).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,14).sql index 3a88c2b697a..3b3801fe994 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,14).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,15).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,15).sql index e7b8a99b90c..ee6e2e965f2 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,15).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MariaDB.11,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,14).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,14).sql index a993f470110..f65b43cfc34 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,14).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,15).sql b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,15).sql index 46f370e7877..2615409b779 100644 --- a/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,15).sql +++ b/MariaDB.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MariaDB.11,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MariaDB.11/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MariaDB.11).sql b/MariaDB.11/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MariaDB.11).sql index 45876cafa0f..58fbdd8758e 100644 --- a/MariaDB.11/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MariaDB.11).sql @@ -3,7 +3,7 @@ SELECT `person_1`.`PersonID`, - `y_1`.`PersonID` + `t1`.`PersonID` FROM ( SELECT @@ -19,8 +19,8 @@ FROM `Patient` `pat` WHERE `pat`.`Diagnosis` = 'b' - ) `y_1` - INNER JOIN `Person` `person_1` ON `y_1`.`PersonID` = `person_1`.`PersonID` + ) `t1` + INNER JOIN `Person` `person_1` ON `t1`.`PersonID` = `person_1`.`PersonID` ORDER BY `person_1`.`PersonID` diff --git a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11).sql b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11).sql index edf1fe8b5ce..49aa7b722ef 100644 --- a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MariaDB.11).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11).sql index 4a3a8abbe58..f504bb42174 100644 --- a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MariaDB.11).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11).sql index a4501128d0f..fd6e59b42d4 100644 --- a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MariaDB.11).sql @@ -2,13 +2,13 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11).sql index 0ed411fc5dd..de22b140cc6 100644 --- a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MariaDB.11).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11).sql index 3b7ce8c6210..868ab363747 100644 --- a/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MariaDB.11).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11).sql index c6fd72435d3..a61aacccf1a 100644 --- a/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MariaDB.11).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -97,13 +97,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11).sql index 63d598857f5..a03c54a2720 100644 --- a/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MariaDB.11).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11).sql index 2fc1abb416a..f043eabb73f 100644 --- a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MariaDB.11).sql @@ -2,11 +2,11 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11).sql index 8001dc5dc98..89fbffb59d5 100644 --- a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MariaDB.11).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11).sql index 8001dc5dc98..022c8796735 100644 --- a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MariaDB.11).sql @@ -2,11 +2,11 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11).sql index 418355f2c75..49e636cd15e 100644 --- a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MariaDB.11).sql @@ -2,11 +2,11 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11).sql b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11).sql index be31bcb44f7..9317401228d 100644 --- a/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MariaDB.11).sql @@ -2,17 +2,21 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MariaDB.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MariaDB.11).sql b/MariaDB.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MariaDB.11).sql new file mode 100644 index 00000000000..9ca82aea614 --- /dev/null +++ b/MariaDB.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MariaDB.11).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MariaDB.11).sql new file mode 100644 index 00000000000..2f8ee903d85 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MariaDB.11).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MariaDB.11).sql new file mode 100644 index 00000000000..9b07ad19053 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MariaDB.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11).sql index de6c2b2609e..9b07ad19053 100644 --- a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MariaDB.11).sql @@ -2,17 +2,10 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11).sql index bb5274e7734..186a2bb00e1 100644 --- a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11).sql +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MariaDB.11).sql @@ -2,14 +2,10 @@ -- MariaDB.11 MariaDB.10.MySqlConnector MySql SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MariaDB.11).sql new file mode 100644 index 00000000000..fb0fd630568 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MariaDB.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MariaDB.11).sql new file mode 100644 index 00000000000..18bdc18e081 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MariaDB.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MariaDB.11).sql new file mode 100644 index 00000000000..186a2bb00e1 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MariaDB.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MariaDB.11).sql new file mode 100644 index 00000000000..29debf43e2b --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MariaDB.11).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MariaDB.11).sql new file mode 100644 index 00000000000..de6c2b2609e --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MariaDB.11).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MariaDB.11).sql new file mode 100644 index 00000000000..bb5274e7734 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MariaDB.11).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MariaDB.11 MariaDB.10.MySqlConnector MySql + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11).sql b/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11).sql index 22a21b6b28c..072e05e8273 100644 --- a/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11).sql +++ b/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MariaDB.11).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11).sql b/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11).sql index b93ce5ed5dc..223c3358638 100644 --- a/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11).sql +++ b/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MariaDB.11).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11).sql b/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11).sql index 6f0ea598d55..edf92110c4b 100644 --- a/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11).sql +++ b/MariaDB.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MariaDB.11).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7.LinqService).sql index 42a3f20c1de..1ce82e7cd86 100644 --- a/MySql.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) + WHEN `t1`.`ParentID_1` IS NULL THEN 0 + ELSE `t1`.`ParentID_1` END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - `Parent` `p` + ( + SELECT + `p`.`ParentID`, + ( + SELECT + `c_1`.`ParentID` + FROM + `Child` `c_1` + WHERE + `c_1`.`ParentID` > 0 + ORDER BY + `c_1`.`ParentID` + LIMIT 1 + ) as `ParentID_1` + FROM + `Parent` `p` + ) `t1` ORDER BY - `p`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7.LinqService).sql index 66edaab933c..8861d79d6b9 100644 --- a/MySql.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7.LinqService).sql @@ -14,8 +14,8 @@ FROM ) `m_1` INNER JOIN ( SELECT DISTINCT - `d`.`ParentID`, - `d`.`ChildID` + `d`.`ChildID`, + `d`.`ParentID` FROM `Child` `d` WHERE diff --git a/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,1).sql b/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,1).sql index ce560722d70..3d0b8d6c24a 100644 --- a/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,1).sql +++ b/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,2).sql b/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,2).sql index 07ac6c319a7..510fae4bd4a 100644 --- a/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,2).sql +++ b/MySql.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7.LinqService).sql index 684c3624418..c2f95d3a501 100644 --- a/MySql.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,14).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,14).sql index 52ad9792313..697cdc91cab 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,14).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,15).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,15).sql index 16bdfb16b33..4f79cc750fc 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,15).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,14).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,14).sql index 0fd9a22997d..01b9fa6861b 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,14).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,15).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,15).sql index da4f5252603..0a64683abe4 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,15).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,14).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,14).sql index 9d269d89bfc..d8414e08bd0 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,14).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,15).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,15).sql index 95af3d25e1d..56a57d118d2 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,15).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,14).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,14).sql index 7cb6b398b7d..0082dbe6094 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,14).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,15).sql b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,15).sql index 7a3ccf0668d..71ac41ad697 100644 --- a/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,15).sql +++ b/MySql.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7.LinqService).sql index 94a9c008583..b2be915d47d 100644 --- a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7.LinqService).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7.LinqService).sql index e961a520718..22fb8ed9a3c 100644 --- a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7.LinqService).sql index 64f5170bd1d..203824adedc 100644 --- a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7.LinqService).sql @@ -2,13 +2,13 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7.LinqService).sql index 88255a8a592..ebf86cdbdf6 100644 --- a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7.LinqService).sql index df70fded43a..500be739097 100644 --- a/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7.LinqService).sql index e18238d7d9c..fe468af6db4 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -535,13 +535,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7.LinqService).sql index 4b241c55eee..4813c4f88aa 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7.LinqService).sql index f8df9b9945b..1de2b600082 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7.LinqService).sql @@ -2,11 +2,11 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7.LinqService).sql index fc4782f2046..68a1fc2935c 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7.LinqService).sql index fc4782f2046..57df6bb1363 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7.LinqService).sql @@ -2,11 +2,11 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7.LinqService).sql index 97d07c00d42..6ef1d4cc6f4 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7.LinqService).sql @@ -2,11 +2,11 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7.LinqService).sql index b0f08d5ec9a..3231b59293b 100644 --- a/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7.LinqService).sql @@ -2,17 +2,21 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySql.5.7.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..4c47c7d8dfd --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.5.7.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..0ae34e030b3 --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.5.7.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..3a8472f67ae --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7.LinqService).sql index 91e2e8f21af..3a8472f67ae 100644 --- a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7.LinqService).sql @@ -2,17 +2,10 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7.LinqService).sql index e94f469ccf1..26ad95beffd 100644 --- a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7.LinqService).sql @@ -2,14 +2,10 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..8bd4878868d --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..ed4c825a96a --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..26ad95beffd --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..52866b87096 --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.5.7.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..91e2e8f21af --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.5.7.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.5.7.LinqService).sql new file mode 100644 index 00000000000..e94f469ccf1 --- /dev/null +++ b/MySql.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.5.7.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7.LinqService).sql index 855dcf03dc9..f20b387c6eb 100644 --- a/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7.LinqService).sql index bb8110a76c4..1a2a8f9609d 100644 --- a/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7.LinqService).sql b/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7.LinqService).sql index d0f6f2a7964..2c50ec575c9 100644 --- a/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7.LinqService).sql +++ b/MySql.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7).sql b/MySql.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7).sql index 42a3f20c1de..1ce82e7cd86 100644 --- a/MySql.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySql.5.7).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) + WHEN `t1`.`ParentID_1` IS NULL THEN 0 + ELSE `t1`.`ParentID_1` END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - `Parent` `p` + ( + SELECT + `p`.`ParentID`, + ( + SELECT + `c_1`.`ParentID` + FROM + `Child` `c_1` + WHERE + `c_1`.`ParentID` > 0 + ORDER BY + `c_1`.`ParentID` + LIMIT 1 + ) as `ParentID_1` + FROM + `Parent` `p` + ) `t1` ORDER BY - `p`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7).sql b/MySql.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7).sql index e6f9cf17057..6d796ecd412 100644 --- a/MySql.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.5.7).sql @@ -16,8 +16,8 @@ FROM ) `m_1` INNER JOIN ( SELECT DISTINCT - `d`.`ParentID`, - `d`.`ChildID` + `d`.`ChildID`, + `d`.`ParentID` FROM `Child` `d` WHERE diff --git a/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,1).sql b/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,1).sql index ce560722d70..3d0b8d6c24a 100644 --- a/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,1).sql +++ b/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,2).sql b/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,2).sql index 07ac6c319a7..510fae4bd4a 100644 --- a/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,2).sql +++ b/MySql.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.5.7,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7).sql b/MySql.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7).sql index 684c3624418..c2f95d3a501 100644 --- a/MySql.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.5.7).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,14).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,14).sql index 9d3d3818d21..e9de5a1b129 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,14).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,15).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,15).sql index 5b48a279dd9..33d7a3d6f82 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,15).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,14).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,14).sql index 984386f84ba..cb25b42222d 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,14).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,15).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,15).sql index 6c6857d9d10..5a81f6684f1 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,15).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,14).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,14).sql index d1477b2e229..8d8218970f2 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,14).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,15).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,15).sql index cbbd311df4d..58cf93af4ed 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,15).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,14).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,14).sql index 483f8ca920b..0123c36748c 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,14).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,15).sql b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,15).sql index 86c0fa33d2f..c3bc6c12364 100644 --- a/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,15).sql +++ b/MySql.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.5.7).sql b/MySql.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.5.7).sql index d1c9def4053..3cd557406b1 100644 --- a/MySql.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.5.7).sql @@ -3,7 +3,7 @@ SELECT `person_1`.`PersonID`, - `y_1`.`PersonID` + `t1`.`PersonID` FROM ( SELECT @@ -19,8 +19,8 @@ FROM `Patient` `pat` WHERE `pat`.`Diagnosis` = 'b' - ) `y_1` - INNER JOIN `Person` `person_1` ON `y_1`.`PersonID` = `person_1`.`PersonID` + ) `t1` + INNER JOIN `Person` `person_1` ON `t1`.`PersonID` = `person_1`.`PersonID` ORDER BY `person_1`.`PersonID` diff --git a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7).sql b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7).sql index 94a9c008583..b2be915d47d 100644 --- a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.5.7).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7).sql b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7).sql index e961a520718..22fb8ed9a3c 100644 --- a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.5.7).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7).sql b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7).sql index 64f5170bd1d..203824adedc 100644 --- a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.5.7).sql @@ -2,13 +2,13 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7).sql b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7).sql index 88255a8a592..ebf86cdbdf6 100644 --- a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.5.7).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7).sql b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7).sql index df70fded43a..500be739097 100644 --- a/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.5.7).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7).sql index 2e0809710cc..b21dc15a9c7 100644 --- a/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.5.7).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -97,13 +97,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7).sql index a9f2282619a..9d90f1eea9d 100644 --- a/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.5.7).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7).sql index f8df9b9945b..1de2b600082 100644 --- a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.5.7).sql @@ -2,11 +2,11 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7).sql index fc4782f2046..68a1fc2935c 100644 --- a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.5.7).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7).sql index fc4782f2046..57df6bb1363 100644 --- a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.5.7).sql @@ -2,11 +2,11 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7).sql index 97d07c00d42..6ef1d4cc6f4 100644 --- a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.5.7).sql @@ -2,11 +2,11 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7).sql b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7).sql index b0f08d5ec9a..3231b59293b 100644 --- a/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.5.7).sql @@ -2,17 +2,21 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySql.5.7/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.5.7).sql b/MySql.5.7/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.5.7).sql new file mode 100644 index 00000000000..f154ac9ff5b --- /dev/null +++ b/MySql.5.7/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.5.7).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.5.7).sql new file mode 100644 index 00000000000..0ae34e030b3 --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.5.7).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.5.7).sql new file mode 100644 index 00000000000..3a8472f67ae --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7).sql index 91e2e8f21af..3a8472f67ae 100644 --- a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.5.7).sql @@ -2,17 +2,10 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7).sql index e94f469ccf1..26ad95beffd 100644 --- a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7).sql +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.5.7).sql @@ -2,14 +2,10 @@ -- MySql.5.7 MySql.5.7.MySql.Data MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.5.7).sql new file mode 100644 index 00000000000..8bd4878868d --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.5.7).sql new file mode 100644 index 00000000000..ed4c825a96a --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.5.7).sql new file mode 100644 index 00000000000..26ad95beffd --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.5.7).sql new file mode 100644 index 00000000000..52866b87096 --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.5.7).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.5.7).sql new file mode 100644 index 00000000000..91e2e8f21af --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.5.7).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.5.7).sql b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.5.7).sql new file mode 100644 index 00000000000..e94f469ccf1 --- /dev/null +++ b/MySql.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.5.7).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.5.7 MySql.5.7.MySql.Data MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7).sql b/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7).sql index 855dcf03dc9..f20b387c6eb 100644 --- a/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7).sql +++ b/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.5.7).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7).sql b/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7).sql index bb8110a76c4..1a2a8f9609d 100644 --- a/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7).sql +++ b/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.5.7).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7).sql b/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7).sql index d0f6f2a7964..2c50ec575c9 100644 --- a/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7).sql +++ b/MySql.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.5.7).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0.LinqService,False).sql b/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0.LinqService,False).sql index 54e2eb0be0f..780ec39e988 100644 --- a/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0.LinqService,False).sql +++ b/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` FROM - `Issue4167Table` `g_1` -WHERE - `g_1`.`Value` = '000001' -GROUP BY - `g_1`.`Value`, - `g_1`.`EnumValue` + ( + SELECT + CASE + WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` + ELSE 0 + END as `EnumValue` + FROM + `Issue4167Table` `g_1` + WHERE + `g_1`.`Value` = '000001' + GROUP BY + `g_1`.`Value`, + `g_1`.`EnumValue` + ) `t1` ORDER BY - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` BeforeExecute -- MySql.8.0 MySql.8.0.MySql.Data MySql80 diff --git a/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0.LinqService).sql index 2c18bf81aa4..c568b117966 100644 --- a/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0.LinqService).sql @@ -67,10 +67,10 @@ SELECT `c4`.`ChildID`, `c4`.`ParentID` FROM - `Child` `p` - INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `p`.`ParentID` + `Child` `c_1` + INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `c_1`.`ParentID` WHERE - `p`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 + `c_1`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 ORDER BY `c4`.`ChildID`, `c4`.`ParentID` diff --git a/MySql.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0.LinqService).sql index 3476364feb9..74245ceed5e 100644 --- a/MySql.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - `a_Children`.`ParentID`, - `a_Children`.`ChildID` + `a_Children`.`ChildID`, + `a_Children`.`ParentID` FROM `Child` `a_Children` WHERE diff --git a/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,1).sql b/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,1).sql index dfe6819b1bb..15b0d645c77 100644 --- a/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,1).sql +++ b/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,2).sql b/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,2).sql index 1199df2079d..dc20f70c568 100644 --- a/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,2).sql +++ b/MySql.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0.LinqService).sql index e2d5ca51d28..7198bdc22f8 100644 --- a/MySql.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,14).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,14).sql index cf331a63348..cb7bea317c8 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,14).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,15).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,15).sql index ab78b823969..c2704732936 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,15).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,14).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,14).sql index 5d9ecb8dd2a..bb071ec56ca 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,14).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,15).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,15).sql index 8a8dc4f6f79..5f489d7fe2d 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,15).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,14).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,14).sql index 05456322431..d509228760d 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,14).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,15).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,15).sql index da3741f5132..306624469cc 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,15).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,14).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,14).sql index c4154889cef..9b83ad290e4 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,14).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,15).sql b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,15).sql index 7f78ad862e6..4316d2e9be2 100644 --- a/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,15).sql +++ b/MySql.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0.LinqService).sql index 3bf00561538..f53562b9c78 100644 --- a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0.LinqService).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0.LinqService).sql index e2d6a632311..de969df3f49 100644 --- a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0.LinqService).sql index 1b35633580e..e2b6551cc93 100644 --- a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0.LinqService).sql @@ -2,13 +2,13 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0.LinqService).sql index 0085e33c94c..b11e5357bc1 100644 --- a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0.LinqService).sql index f60e67e2ac1..7845d44a459 100644 --- a/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0.LinqService).sql index e14eb5b5cf3..09538dd2620 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -535,13 +535,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0.LinqService).sql index 57bb63e388c..bd3520fa714 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0.LinqService).sql index 72c0a00a42a..8cc139ace8e 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0.LinqService).sql @@ -2,11 +2,11 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0.LinqService).sql index 4d9239298f7..e80065a3ed9 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0.LinqService).sql index 4d9239298f7..9e5b0a9fcb6 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0.LinqService).sql @@ -2,11 +2,11 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0.LinqService).sql index 73189f7bed3..21eb2a8c3d7 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0.LinqService).sql @@ -2,11 +2,11 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0.LinqService).sql index edcdd0b138a..fc9ed16ddd9 100644 --- a/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0.LinqService).sql @@ -2,17 +2,21 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySql.8.0.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..3180f7ea9e8 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.8.0.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..1a24664b833 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.8.0.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..fa96d536d96 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0.LinqService).sql index c02517a020a..fa96d536d96 100644 --- a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0.LinqService).sql @@ -2,17 +2,10 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0.LinqService).sql index 2e3d038deee..ea895ec84d3 100644 --- a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0.LinqService).sql @@ -2,14 +2,10 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..15490eeb003 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..fd6619a0e09 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..ea895ec84d3 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..9d32d4651c7 --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.8.0.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..c02517a020a --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.8.0.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.8.0.LinqService).sql new file mode 100644 index 00000000000..2e3d038deee --- /dev/null +++ b/MySql.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.8.0.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0.LinqService).sql index 902d6662af9..d15163a265d 100644 --- a/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0.LinqService).sql index 7672f11bd5e..d49bc21cd6b 100644 --- a/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0.LinqService).sql b/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0.LinqService).sql index 2ffd45d2b61..72d439a0d78 100644 --- a/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0.LinqService).sql +++ b/MySql.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0,False).sql b/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0,False).sql index 0b05f4bac6a..4d0693b069e 100644 --- a/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0,False).sql +++ b/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySql.8.0,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` FROM - `Issue4167Table` `g_1` -WHERE - `g_1`.`Value` = '000001' -GROUP BY - `g_1`.`Value`, - `g_1`.`EnumValue` + ( + SELECT + CASE + WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` + ELSE 0 + END as `EnumValue` + FROM + `Issue4167Table` `g_1` + WHERE + `g_1`.`Value` = '000001' + GROUP BY + `g_1`.`Value`, + `g_1`.`EnumValue` + ) `t1` ORDER BY - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` BeforeExecute -- MySql.8.0 MySql.8.0.MySql.Data MySql80 diff --git a/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0).sql b/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0).sql index 2c18bf81aa4..c568b117966 100644 --- a/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySql.8.0).sql @@ -67,10 +67,10 @@ SELECT `c4`.`ChildID`, `c4`.`ParentID` FROM - `Child` `p` - INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `p`.`ParentID` + `Child` `c_1` + INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `c_1`.`ParentID` WHERE - `p`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 + `c_1`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 ORDER BY `c4`.`ChildID`, `c4`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0).sql b/MySql.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0).sql index 3476364feb9..74245ceed5e 100644 --- a/MySql.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySql.8.0).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - `a_Children`.`ParentID`, - `a_Children`.`ChildID` + `a_Children`.`ChildID`, + `a_Children`.`ParentID` FROM `Child` `a_Children` WHERE diff --git a/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,1).sql b/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,1).sql index dfe6819b1bb..15b0d645c77 100644 --- a/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,1).sql +++ b/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,2).sql b/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,2).sql index 1199df2079d..dc20f70c568 100644 --- a/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,2).sql +++ b/MySql.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySql.8.0,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySql.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0).sql b/MySql.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0).sql index e2d5ca51d28..7198bdc22f8 100644 --- a/MySql.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySql.8.0).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,14).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,14).sql index 71a0dabf7b0..fd19e4004c0 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,14).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,15).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,15).sql index a8d4c98e0e9..37818e64c60 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,15).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySql.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,14).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,14).sql index c7c7361591b..8f61f0109e4 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,14).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,15).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,15).sql index a1d2ed9d632..bb05faeaf99 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,15).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySql.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,14).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,14).sql index 7016290c6cf..aca49ca3b8c 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,14).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,15).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,15).sql index a34e02b9b85..8dc4b8fae14 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,15).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySql.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,14).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,14).sql index 3d387bd8f9f..8ff106ffc84 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,14).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,15).sql b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,15).sql index 21aa193b905..f4693917320 100644 --- a/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,15).sql +++ b/MySql.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySql.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySql.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.8.0).sql b/MySql.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.8.0).sql index 9287714d164..cd7444bf7e7 100644 --- a/MySql.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySql.8.0).sql @@ -3,7 +3,7 @@ SELECT `person_1`.`PersonID`, - `y_1`.`PersonID` + `t1`.`PersonID` FROM ( SELECT @@ -19,8 +19,8 @@ FROM `Patient` `pat` WHERE `pat`.`Diagnosis` = 'b' - ) `y_1` - INNER JOIN `Person` `person_1` ON `y_1`.`PersonID` = `person_1`.`PersonID` + ) `t1` + INNER JOIN `Person` `person_1` ON `t1`.`PersonID` = `person_1`.`PersonID` ORDER BY `person_1`.`PersonID` diff --git a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0).sql b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0).sql index 3bf00561538..f53562b9c78 100644 --- a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySql.8.0).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0).sql index e2d6a632311..de969df3f49 100644 --- a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySql.8.0).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0).sql index 1b35633580e..e2b6551cc93 100644 --- a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySql.8.0).sql @@ -2,13 +2,13 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0).sql index 0085e33c94c..b11e5357bc1 100644 --- a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySql.8.0).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0).sql index f60e67e2ac1..7845d44a459 100644 --- a/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySql.8.0).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0).sql index 2da8bd76491..cee52fe5961 100644 --- a/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySql.8.0).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -97,13 +97,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0).sql index 8a3cd0fdf9d..ee058241d20 100644 --- a/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySql.8.0).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0).sql index 72c0a00a42a..8cc139ace8e 100644 --- a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySql.8.0).sql @@ -2,11 +2,11 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0).sql index 4d9239298f7..e80065a3ed9 100644 --- a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySql.8.0).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0).sql index 4d9239298f7..9e5b0a9fcb6 100644 --- a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySql.8.0).sql @@ -2,11 +2,11 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0).sql index 73189f7bed3..21eb2a8c3d7 100644 --- a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySql.8.0).sql @@ -2,11 +2,11 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0).sql b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0).sql index edcdd0b138a..fc9ed16ddd9 100644 --- a/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySql.8.0).sql @@ -2,17 +2,21 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.8.0).sql b/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.8.0).sql new file mode 100644 index 00000000000..3c6a50765ae --- /dev/null +++ b/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySql.8.0).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySql.8.0).sql b/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySql.8.0).sql index 78307633b1d..b402443cc00 100644 --- a/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySql.8.0).sql @@ -2,38 +2,28 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `t6`.`ParentID_6`, - `t6`.`Value1`, `t6`.`ParentID`, + `t6`.`Value1`, + `t6`.`ParentID_1`, `t6`.`ChildID`, `t6`.`Any_1`, `t6`.`ChildID_1`, - `t6`.`ParentID_1`, - `t6`.`ChildID_2`, `t6`.`ParentID_2`, - `t6`.`ChildID_3`, + `t6`.`ChildID_2`, `t6`.`ParentID_3`, - `t6`.`ChildID_4`, + `t6`.`ChildID_3`, `t6`.`ParentID_4`, + `t6`.`ChildID_4`, + `t6`.`ParentID_5`, `t6`.`ChildID_5`, - `t6`.`ParentID_5` + `t6`.`ParentID_6` FROM ( SELECT DISTINCT - `c1_1`.`ParentID`, - `c1_1`.`ChildID`, - `t1`.`ChildID` as `ChildID_1`, - `t1`.`ParentID` as `ParentID_1`, - `t2`.`ChildID` as `ChildID_2`, - `t2`.`ParentID` as `ParentID_2`, - `t3`.`ChildID` as `ChildID_3`, - `t3`.`ParentID` as `ParentID_3`, - `t4`.`ChildID` as `ChildID_4`, - `t4`.`ParentID` as `ParentID_4`, - `t5`.`ChildID` as `ChildID_5`, - `t5`.`ParentID` as `ParentID_5`, - `p`.`ParentID` as `ParentID_6`, + `p`.`ParentID`, `p`.`Value1`, + `c1_1`.`ParentID` as `ParentID_1`, + `c1_1`.`ChildID`, CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as `Any_1` + END as `Any_1`, + `t1`.`ChildID` as `ChildID_1`, + `t1`.`ParentID` as `ParentID_2`, + `t2`.`ChildID` as `ChildID_2`, + `t2`.`ParentID` as `ParentID_3`, + `t3`.`ChildID` as `ChildID_3`, + `t3`.`ParentID` as `ParentID_4`, + `t4`.`ChildID` as `ChildID_4`, + `t4`.`ParentID` as `ParentID_5`, + `t5`.`ChildID` as `ChildID_5`, + `t5`.`ParentID` as `ParentID_6` FROM `Parent` `p` LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) `t5` ON 1=1 ) `t6` ORDER BY - `t6`.`ParentID_6` + `t6`.`ParentID` diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.8.0).sql new file mode 100644 index 00000000000..1a24664b833 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySql.8.0).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.8.0).sql new file mode 100644 index 00000000000..fa96d536d96 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySql.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0).sql index c02517a020a..fa96d536d96 100644 --- a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySql.8.0).sql @@ -2,17 +2,10 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0).sql index 2e3d038deee..ea895ec84d3 100644 --- a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0).sql +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySql.8.0).sql @@ -2,14 +2,10 @@ -- MySql.8.0 MySql.8.0.MySql.Data MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.8.0).sql new file mode 100644 index 00000000000..15490eeb003 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySql.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.8.0).sql new file mode 100644 index 00000000000..fd6619a0e09 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySql.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.8.0).sql new file mode 100644 index 00000000000..ea895ec84d3 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySql.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.8.0).sql new file mode 100644 index 00000000000..9d32d4651c7 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySql.8.0).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.8.0).sql new file mode 100644 index 00000000000..c02517a020a --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySql.8.0).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.8.0).sql new file mode 100644 index 00000000000..2e3d038deee --- /dev/null +++ b/MySql.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySql.8.0).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0).sql b/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0).sql index 902d6662af9..d15163a265d 100644 --- a/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0).sql +++ b/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySql.8.0).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0).sql b/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0).sql index 7672f11bd5e..d49bc21cd6b 100644 --- a/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0).sql +++ b/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySql.8.0).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0).sql b/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0).sql index 2ffd45d2b61..72d439a0d78 100644 --- a/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0).sql +++ b/MySql.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySql.8.0).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7.LinqService).sql index d86ccb34a7c..b234306f084 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) + WHEN `t1`.`ParentID_1` IS NULL THEN 0 + ELSE `t1`.`ParentID_1` END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - `Parent` `p` + ( + SELECT + `p`.`ParentID`, + ( + SELECT + `c_1`.`ParentID` + FROM + `Child` `c_1` + WHERE + `c_1`.`ParentID` > 0 + ORDER BY + `c_1`.`ParentID` + LIMIT 1 + ) as `ParentID_1` + FROM + `Parent` `p` + ) `t1` ORDER BY - `p`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7.LinqService).sql index bdb4166ad3c..27e43d7dca7 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7.LinqService).sql @@ -14,8 +14,8 @@ FROM ) `m_1` INNER JOIN ( SELECT DISTINCT - `d`.`ParentID`, - `d`.`ChildID` + `d`.`ChildID`, + `d`.`ParentID` FROM `Child` `d` WHERE diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,1).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,1).sql index eba368c03a0..d9d586edc3c 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,1).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,2).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,2).sql index 506c9fd2779..4a26ddfc537 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,2).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7.LinqService).sql index a28889abeee..de09ab1803d 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,14).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,14).sql index 8885eb4c9bf..89ce9aac314 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,14).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,15).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,15).sql index 392ea1ee40a..c55b7449766 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,15).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,14).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,14).sql index 23acd7bde19..d45b149e6f5 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,14).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,15).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,15).sql index 9dd769cb51e..180497cfeba 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,15).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,14).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,14).sql index b865c064aa0..3eb63cf8fa5 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,14).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,15).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,15).sql index b2e8f5baae1..7b17b407efd 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,15).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,14).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,14).sql index 37002c93fae..d88febc31f0 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,14).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,15).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,15).sql index 0c59d0679d4..9481d85a15d 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,15).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7.LinqService).sql index bbd60aec294..6d41c83b766 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7.LinqService).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7.LinqService).sql index 7514a7a858c..cd4c392b90d 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7.LinqService).sql index e813092d375..902be7b1bb0 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7.LinqService).sql @@ -2,13 +2,13 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7.LinqService).sql index d79a1bb2346..35100bdc281 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7.LinqService).sql index 71a3dacedd8..a5fb27286a4 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7.LinqService).sql index 3cee336f01c..005e2384123 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -535,13 +535,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7.LinqService).sql index aedfcc6eea4..fe8fae00bce 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7.LinqService).sql index 0b952ff7085..855cbb760b9 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7.LinqService).sql @@ -2,11 +2,11 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7.LinqService).sql index 0ccefe4ca07..1957580ee99 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7.LinqService).sql index 0ccefe4ca07..a3d6484b051 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7.LinqService).sql @@ -2,11 +2,11 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7.LinqService).sql index 01a434845cf..c9b4dd385a3 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7.LinqService).sql @@ -2,11 +2,11 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7.LinqService).sql index 04b66a38e03..91600b0dd84 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7.LinqService).sql @@ -2,17 +2,21 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..812a76ae896 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..363a34a05e6 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..43efb672894 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7.LinqService).sql index bf4087d8ae8..43efb672894 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7.LinqService).sql @@ -2,17 +2,10 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7.LinqService).sql index b4a37767e36..0d0f7c53d00 100644 --- a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7.LinqService).sql @@ -2,14 +2,10 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..7fa1b796b78 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..759d0d54286 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..0d0f7c53d00 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..ce254a8aed7 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..bf4087d8ae8 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.5.7.LinqService).sql new file mode 100644 index 00000000000..b4a37767e36 --- /dev/null +++ b/MySqlConnector.5.7.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.5.7.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7.LinqService).sql index f49b071ff6f..f0f609bb5ef 100644 --- a/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7.LinqService).sql index 5d9c09c3fc0..f78351eb5de 100644 --- a/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7.LinqService).sql b/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7.LinqService).sql index ee0d524f429..163cbd9f15f 100644 --- a/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7.LinqService).sql +++ b/MySqlConnector.5.7.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7).sql index d86ccb34a7c..b234306f084 100644 --- a/MySqlConnector.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(MySqlConnector.5.7).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - `c_1`.`ParentID` - FROM - `Child` `c_1` - WHERE - `c_1`.`ParentID` > 0 - ORDER BY - `c_1`.`ParentID` - LIMIT 1 - ) + WHEN `t1`.`ParentID_1` IS NULL THEN 0 + ELSE `t1`.`ParentID_1` END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - `Parent` `p` + ( + SELECT + `p`.`ParentID`, + ( + SELECT + `c_1`.`ParentID` + FROM + `Child` `c_1` + WHERE + `c_1`.`ParentID` > 0 + ORDER BY + `c_1`.`ParentID` + LIMIT 1 + ) as `ParentID_1` + FROM + `Parent` `p` + ) `t1` ORDER BY - `p`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7).sql index ad01d74f8de..3fe548ccd16 100644 --- a/MySqlConnector.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.5.7).sql @@ -16,8 +16,8 @@ FROM ) `m_1` INNER JOIN ( SELECT DISTINCT - `d`.`ParentID`, - `d`.`ChildID` + `d`.`ChildID`, + `d`.`ParentID` FROM `Child` `d` WHERE diff --git a/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,1).sql b/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,1).sql index eba368c03a0..d9d586edc3c 100644 --- a/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,1).sql +++ b/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,2).sql b/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,2).sql index 506c9fd2779..4a26ddfc537 100644 --- a/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,2).sql +++ b/MySqlConnector.5.7/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.5.7,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7).sql index a28889abeee..de09ab1803d 100644 --- a/MySqlConnector.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.5.7).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,14).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,14).sql index 4fbd6403c61..de125d71ab5 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,14).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,15).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,15).sql index 5a7c0a71149..710a31311ad 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,15).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,14).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,14).sql index f0c98a30254..9189f9da4fe 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,14).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,15).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,15).sql index 83b00ebb5b6..3cfbc83ec56 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,15).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,14).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,14).sql index 7eecdb9850e..47195a776cb 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,14).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,15).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,15).sql index 21e85c550f7..28968751fb2 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,15).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,14).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,14).sql index 25912dbd965..0dbf8c464d9 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,14).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,15).sql b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,15).sql index 535b3deb661..dc0adb33702 100644 --- a/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,15).sql +++ b/MySqlConnector.5.7/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.5.7,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.5.7).sql index 7d07dbbab8c..c0e44022fff 100644 --- a/MySqlConnector.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.5.7).sql @@ -3,7 +3,7 @@ SELECT `person_1`.`PersonID`, - `y_1`.`PersonID` + `t1`.`PersonID` FROM ( SELECT @@ -19,8 +19,8 @@ FROM `Patient` `pat` WHERE `pat`.`Diagnosis` = 'b' - ) `y_1` - INNER JOIN `Person` `person_1` ON `y_1`.`PersonID` = `person_1`.`PersonID` + ) `t1` + INNER JOIN `Person` `person_1` ON `t1`.`PersonID` = `person_1`.`PersonID` ORDER BY `person_1`.`PersonID` diff --git a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7).sql index bbd60aec294..6d41c83b766 100644 --- a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.5.7).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7).sql index 7514a7a858c..cd4c392b90d 100644 --- a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.5.7).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7).sql index e813092d375..902be7b1bb0 100644 --- a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.5.7).sql @@ -2,13 +2,13 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7).sql index d79a1bb2346..35100bdc281 100644 --- a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.5.7).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7).sql index 71a3dacedd8..a5fb27286a4 100644 --- a/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.5.7).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7).sql index 72bf445dceb..1f3491ea931 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.5.7).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -97,13 +97,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7).sql index 4f93ae1f393..c6222f702b0 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.5.7).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7).sql index 0b952ff7085..855cbb760b9 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.5.7).sql @@ -2,11 +2,11 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7).sql index 0ccefe4ca07..1957580ee99 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.5.7).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7).sql index 0ccefe4ca07..a3d6484b051 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.5.7).sql @@ -2,11 +2,11 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7).sql index 01a434845cf..c9b4dd385a3 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.5.7).sql @@ -2,11 +2,11 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7).sql index 04b66a38e03..91600b0dd84 100644 --- a/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.5.7).sql @@ -2,17 +2,21 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySqlConnector.5.7/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..869376d50b3 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.5.7).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..363a34a05e6 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.5.7).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..43efb672894 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7).sql index bf4087d8ae8..43efb672894 100644 --- a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.5.7).sql @@ -2,17 +2,10 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7).sql index b4a37767e36..0d0f7c53d00 100644 --- a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.5.7).sql @@ -2,14 +2,10 @@ -- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..7fa1b796b78 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..759d0d54286 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..0d0f7c53d00 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.5.7).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..ce254a8aed7 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.5.7).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..bf4087d8ae8 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.5.7).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.5.7).sql new file mode 100644 index 00000000000..b4a37767e36 --- /dev/null +++ b/MySqlConnector.5.7/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.5.7).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.5.7 MySql.5.7.MySqlConnector MySql57 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7).sql index f49b071ff6f..f0f609bb5ef 100644 --- a/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.5.7).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7).sql index 5d9c09c3fc0..f78351eb5de 100644 --- a/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.5.7).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7).sql b/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7).sql index ee0d524f429..163cbd9f15f 100644 --- a/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7).sql +++ b/MySqlConnector.5.7/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.5.7).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0.LinqService,False).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0.LinqService,False).sql index dc8752c5325..bd4ded6a91a 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0.LinqService,False).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` FROM - `Issue4167Table` `g_1` -WHERE - `g_1`.`Value` = '000001' -GROUP BY - `g_1`.`Value`, - `g_1`.`EnumValue` + ( + SELECT + CASE + WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` + ELSE 0 + END as `EnumValue` + FROM + `Issue4167Table` `g_1` + WHERE + `g_1`.`Value` = '000001' + GROUP BY + `g_1`.`Value`, + `g_1`.`EnumValue` + ) `t1` ORDER BY - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` BeforeExecute -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0.LinqService).sql index 7d845e206d2..66c71104d96 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0.LinqService).sql @@ -67,10 +67,10 @@ SELECT `c4`.`ChildID`, `c4`.`ParentID` FROM - `Child` `p` - INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `p`.`ParentID` + `Child` `c_1` + INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `c_1`.`ParentID` WHERE - `p`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 + `c_1`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 ORDER BY `c4`.`ChildID`, `c4`.`ParentID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0.LinqService).sql index 843f272febc..8de1069e7fe 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - `a_Children`.`ParentID`, - `a_Children`.`ChildID` + `a_Children`.`ChildID`, + `a_Children`.`ParentID` FROM `Child` `a_Children` WHERE diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,1).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,1).sql index 9bfa6357c59..97abc16da34 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,1).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,2).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,2).sql index cd4b4900b8e..8f7e6213c05 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,2).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0.LinqService).sql index 6838f93e100..ef771d191ab 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,14).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,14).sql index a731f53b210..2a4563afac3 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,14).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,15).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,15).sql index a276126baaa..f7d50e7d866 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,15).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,14).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,14).sql index 78a6b8ec61a..4e8f2fc7067 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,14).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,15).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,15).sql index cd63edec827..27816a60e4a 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,15).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,14).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,14).sql index edf23d91cb8..0fe0eca986c 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,14).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,15).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,15).sql index 4d45617f44a..5235a89593b 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,15).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,14).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,14).sql index 794d39e28d2..794277ad66b 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,14).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,15).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,15).sql index 9c677f0e1d2..c96a0b0b471 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,15).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0.LinqService).sql index c8e35c9680a..b458d54c75b 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0.LinqService).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0.LinqService).sql index 55f7f8e10a7..112932b59cf 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0.LinqService).sql index 2260bfd6810..a27d5802103 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0.LinqService).sql @@ -2,13 +2,13 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0.LinqService).sql index a34836d2305..a75f24bb687 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0.LinqService).sql index d78e693c533..07798c5c640 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0.LinqService).sql index 2662ba323ec..a5282b8268d 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -535,13 +535,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0.LinqService).sql index e229cf8f194..cef1e472099 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0.LinqService).sql index 9b1db384ef2..e38191abce4 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0.LinqService).sql @@ -2,11 +2,11 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0.LinqService).sql index 247b24cf07d..c2ba87197a5 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0.LinqService).sql index 247b24cf07d..310d0ce00f3 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0.LinqService).sql @@ -2,11 +2,11 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0.LinqService).sql index 1b127a6abf1..93aee292997 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0.LinqService).sql @@ -2,11 +2,11 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0.LinqService).sql index f832e1c5a1b..e3634a8063c 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0.LinqService).sql @@ -2,17 +2,21 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..e3cda3e6b13 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..aff7d7a53ab --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..6c07c7dbec4 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0.LinqService).sql index aff1dc4730e..6c07c7dbec4 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0.LinqService).sql @@ -2,17 +2,10 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0.LinqService).sql index 58dad2b3db1..a4573c6d034 100644 --- a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0.LinqService).sql @@ -2,14 +2,10 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..8eb21b7f300 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..6b46e669889 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..a4573c6d034 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..7d9bad55f55 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..aff1dc4730e --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.8.0.LinqService).sql new file mode 100644 index 00000000000..58dad2b3db1 --- /dev/null +++ b/MySqlConnector.8.0.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.8.0.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0.LinqService).sql index d333e098bd9..5654d054f09 100644 --- a/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0.LinqService).sql index 0292478a289..82967f85007 100644 --- a/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0.LinqService).sql b/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0.LinqService).sql index c41d5fdc048..59d562b1118 100644 --- a/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0.LinqService).sql +++ b/MySqlConnector.8.0.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0,False).sql b/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0,False).sql index 8d73768b9c7..94acaa5c5f6 100644 --- a/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0,False).sql +++ b/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(MySqlConnector.8.0,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` FROM - `Issue4167Table` `g_1` -WHERE - `g_1`.`Value` = '000001' -GROUP BY - `g_1`.`Value`, - `g_1`.`EnumValue` + ( + SELECT + CASE + WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` + ELSE 0 + END as `EnumValue` + FROM + `Issue4167Table` `g_1` + WHERE + `g_1`.`Value` = '000001' + GROUP BY + `g_1`.`Value`, + `g_1`.`EnumValue` + ) `t1` ORDER BY - CASE - WHEN `g_1`.`EnumValue` IS NOT NULL THEN `g_1`.`EnumValue` - ELSE 0 - END + `t1`.`EnumValue` BeforeExecute -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 diff --git a/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0).sql index 7d845e206d2..66c71104d96 100644 --- a/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(MySqlConnector.8.0).sql @@ -67,10 +67,10 @@ SELECT `c4`.`ChildID`, `c4`.`ParentID` FROM - `Child` `p` - INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `p`.`ParentID` + `Child` `c_1` + INNER JOIN `Child` `c4` ON `c4`.`ParentID` = `c_1`.`ParentID` WHERE - `p`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 + `c_1`.`ParentID` > 1 AND `c4`.`ParentID` % 2 = 0 ORDER BY `c4`.`ChildID`, `c4`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0).sql index 843f272febc..8de1069e7fe 100644 --- a/MySqlConnector.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(MySqlConnector.8.0).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - `a_Children`.`ParentID`, - `a_Children`.`ChildID` + `a_Children`.`ChildID`, + `a_Children`.`ParentID` FROM `Child` `a_Children` WHERE diff --git a/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,1).sql b/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,1).sql index 9bfa6357c59..97abc16da34 100644 --- a/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,1).sql +++ b/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,1).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,2).sql b/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,2).sql index cd4b4900b8e..8f7e6213c05 100644 --- a/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,2).sql +++ b/MySqlConnector.8.0/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(MySqlConnector.8.0,2).sql @@ -9,11 +9,11 @@ SELECT `n`.`FirstName`, `n`.`PersonID` FROM - `Person` `p` + `Person` `t1` INNER JOIN ( SELECT 'Janet' AS `FirstName`, @ID AS `PersonID` UNION ALL - SELECT 'Doe', @ID_1) `n` ON `p`.`PersonID` = `n`.`PersonID` + SELECT 'Doe', @ID_1) `n` ON `t1`.`PersonID` = `n`.`PersonID` ORDER BY `n`.`PersonID` diff --git a/MySqlConnector.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0).sql index 6838f93e100..ef771d191ab 100644 --- a/MySqlConnector.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(MySqlConnector.8.0).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT `t1`.`Id`, `t1`.`FirstName`, - `t1`.`LastName`, - Concat(`t1`.`FirstName`, ' ', `t1`.`LastName`) + `t1`.`LastName` FROM `Issue2434Table` `t1` ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,14).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,14).sql index 09e8029cf31..de68c34fe14 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,14).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,15).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,15).sql index f40037f2931..3b8e5e2f50d 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,15).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(MySqlConnector.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,14).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,14).sql index 89faeba46e1..c798528d0e0 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,14).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,15).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,15).sql index 02950062941..4f91ae5e1b0 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,15).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(MySqlConnector.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,14).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,14).sql index 39cc4aad079..7be46e8b24d 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,14).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,15).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,15).sql index 050a6d107f4..f98c6eb65a7 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,15).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(MySqlConnector.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @endId - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,14).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,14).sql index ac213917358..0f3ab7f59cc 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,14).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,14).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,15).sql b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,15).sql index 4d3a3f1ccfb..91897acd29e 100644 --- a/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,15).sql +++ b/MySqlConnector.8.0/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(MySqlConnector.8.0,15).sql @@ -53,10 +53,10 @@ SELECT `s`.`value`, `s`.`id` FROM - `sample_class` `c_1` + `sample_class` `t1` INNER JOIN ( SELECT * FROM `sample_class` where `id` >= @startId and `id` < @p - ) `s` ON `s`.`id` = `c_1`.`id` + ) `s` ON `s`.`id` = `t1`.`id` WHERE `s`.`id` > 10 ORDER BY diff --git a/MySqlConnector.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.8.0).sql index 9de5964aad2..cbd8a2150a6 100644 --- a/MySqlConnector.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(MySqlConnector.8.0).sql @@ -3,7 +3,7 @@ SELECT `person_1`.`PersonID`, - `y_1`.`PersonID` + `t1`.`PersonID` FROM ( SELECT @@ -19,8 +19,8 @@ FROM `Patient` `pat` WHERE `pat`.`Diagnosis` = 'b' - ) `y_1` - INNER JOIN `Person` `person_1` ON `y_1`.`PersonID` = `person_1`.`PersonID` + ) `t1` + INNER JOIN `Person` `person_1` ON `t1`.`PersonID` = `person_1`.`PersonID` ORDER BY `person_1`.`PersonID` diff --git a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0).sql index c8e35c9680a..b458d54c75b 100644 --- a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(MySqlConnector.8.0).sql @@ -4,8 +4,8 @@ SELECT `a_2`.`ParentID`, `a_2`.`Value1`, - `z_1`.`ParentID`, - `z_1`.`Value1`, + `z_2`.`ParentID`, + `z_2`.`Value1`, `y`.`ParentID`, `y`.`Value1`, `a`.`ParentID`, @@ -19,6 +19,13 @@ FROM LEFT JOIN `Parent` `y` ON `a_2`.`ParentID` = `y`.`ParentID` LEFT JOIN `Parent` `a` ON `a_2`.`ParentID` = `a`.`ParentID` LEFT JOIN `Parent` `z` ON `a_2`.`ParentID` = `z`.`ParentID` - LEFT JOIN `Parent` `z_1` ON `a_2`.`ParentID` = Coalesce(`z_1`.`Value1`, 1) + LEFT JOIN ( + SELECT + `z_1`.`ParentID`, + `z_1`.`Value1`, + Coalesce(`z_1`.`Value1`, 1) as `c1` + FROM + `Parent` `z_1` + ) `z_2` ON `a_2`.`ParentID` = `z_2`.`c1` LEFT JOIN `Parent` `a_1` ON `a_2`.`ParentID` = `a_1`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0).sql index 55f7f8e10a7..112932b59cf 100644 --- a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(MySqlConnector.8.0).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -17,7 +17,7 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2 WHERE `right_1`.`ParentID` <> @id2 AND `right2`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_1`.`Value1` OR `right_2`.`c1` IS NULL AND `left_1`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0).sql index 2260bfd6810..a27d5802103 100644 --- a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(MySqlConnector.8.0).sql @@ -2,13 +2,13 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM - `Parent` `left_1` + `Parent` `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0).sql index a34836d2305..a75f24bb687 100644 --- a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(MySqlConnector.8.0).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_1`.`ParentID`, + `t1`.`ParentID`, `right_1`.`ParentID` FROM ( @@ -15,10 +15,10 @@ FROM `Parent` `p` WHERE `p`.`ParentID` <> @id1 - ) `left_1` + ) `t1` RIGHT JOIN (`Parent` `right_1` INNER JOIN `Parent` `right2` ON `right_1`.`Value1` = `right2`.`Value1` + 2) - ON (`right_1`.`Value1` + 2 = `left_1`.`Value1` OR `right_1`.`Value1` IS NULL AND `left_1`.`Value1` IS NULL) + ON (`right_1`.`Value1` + 2 = `t1`.`Value1` OR `right_1`.`Value1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_1`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0).sql index d78e693c533..07798c5c640 100644 --- a/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(MySqlConnector.8.0).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - `left_2`.`ParentID`, + `t1`.`ParentID`, `right_2`.`ParentID` FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN `Parent` `left2` ON `left_1`.`Value1` = `left2`.`Value1` + 2 WHERE `left_1`.`ParentID` <> @id2 AND `left2`.`ParentID` <> @id1 - ) `left_2` + ) `t1` RIGHT JOIN ( SELECT `right_1`.`ParentID`, @@ -27,7 +27,7 @@ FROM `Parent` `right_1` WHERE `right_1`.`ParentID` <> @id1 - ) `right_2` ON (`right_2`.`c1` = `left_2`.`Value1` OR `right_2`.`c1` IS NULL AND `left_2`.`Value1` IS NULL) + ) `right_2` ON (`right_2`.`c1` = `t1`.`Value1` OR `right_2`.`c1` IS NULL AND `t1`.`Value1` IS NULL) ORDER BY - `left_2`.`ParentID` + `t1`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0).sql index 3fe606e7a7b..aa1983931ff 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(MySqlConnector.8.0).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1`) + MAX(`x`.`OrderData1`) LIMIT @skip, @take BeforeExecute @@ -97,13 +97,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MIN(`g_1`.`OrderData1`) DESC + MIN(`x`.`OrderData1`) DESC LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0).sql index 7daeaa44dcf..7125b121658 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(MySqlConnector.8.0).sql @@ -67,13 +67,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - `g_1`.`DuplicateData` + `x`.`DuplicateData` FROM - `OrderByDistinctData` `g_1` + `OrderByDistinctData` `x` GROUP BY - `g_1`.`DuplicateData` + `x`.`DuplicateData` ORDER BY - MAX(`g_1`.`OrderData1` % 3) + MAX(`x`.`OrderData1` % 3) LIMIT @skip, @take BeforeExecute diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0).sql index 9b1db384ef2..e38191abce4 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(MySqlConnector.8.0).sql @@ -2,11 +2,11 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0).sql index 247b24cf07d..c2ba87197a5 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(MySqlConnector.8.0).sql @@ -7,6 +7,6 @@ SELECT FROM `Child` `x` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `x`.`ChildID`, + `x`.`ChildID` % 2 diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0).sql index 247b24cf07d..310d0ce00f3 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(MySqlConnector.8.0).sql @@ -2,11 +2,11 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2, - `x`.`ChildID` + `ch`.`ChildID` % 2, + `ch`.`ChildID` diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0).sql index 1b127a6abf1..93aee292997 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(MySqlConnector.8.0).sql @@ -2,11 +2,11 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `x`.`ParentID`, - `x`.`ChildID` + `ch`.`ParentID`, + `ch`.`ChildID` FROM - `Child` `x` + `Child` `ch` ORDER BY - `x`.`ChildID` % 2 DESC, - `x`.`ChildID` DESC + `ch`.`ChildID` % 2 DESC, + `ch`.`ChildID` DESC diff --git a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0).sql index f832e1c5a1b..e3634a8063c 100644 --- a/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(MySqlConnector.8.0).sql @@ -2,17 +2,21 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `t1`.`PersonID`, - `t1`.`LastName`, - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`ID`, + `t2`.`LastName`, + `t2`.`flag` FROM - `Person` `t1` + ( + SELECT + CASE + WHEN `t1`.`PersonID` IN (1, 3) THEN 1 + ELSE 0 + END as `flag`, + `t1`.`PersonID` as `ID`, + `t1`.`LastName` + FROM + `Person` `t1` + ) `t2` ORDER BY - CASE - WHEN `t1`.`PersonID` IN (1, 3) THEN 1 - ELSE 0 - END + `t2`.`flag` diff --git a/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..50d82871914 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(MySqlConnector.8.0).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +CREATE TABLE IF NOT EXISTS `CoalesceNullableFields` +( + `Id` INT NOT NULL, + `Nullable1` INT NULL, + `Nullable2` INT NULL, + `Nullable3` INT NULL, + + CONSTRAINT `PK_CoalesceNullableFields` PRIMARY KEY CLUSTERED (`Id`) +) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +INSERT INTO `CoalesceNullableFields` +( + `Id`, + `Nullable1`, + `Nullable2`, + `Nullable3` +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable1`, `t`.`Nullable3`, `t`.`Id`), + Coalesce(`t`.`Nullable2`, `t`.`Nullable3`, `t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`), + Coalesce(`t`.`Nullable3`, `t`.`Nullable2`, `t`.`Nullable1`, `t`.`Id`), + `t`.`Id`, + Coalesce(`t`.`Nullable1`, `t`.`Id`), + Coalesce(`t`.`Nullable1`, `t`.`Nullable2`, `t`.`Id`) +FROM + `CoalesceNullableFields` `t` + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t1`.`Id`, + `t1`.`Nullable1`, + `t1`.`Nullable2`, + `t1`.`Nullable3` +FROM + `CoalesceNullableFields` `t1` + +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +DROP TABLE IF EXISTS `CoalesceNullableFields` + diff --git a/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySqlConnector.8.0).sql index 926ba0ca228..28260491dbe 100644 --- a/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(MySqlConnector.8.0).sql @@ -2,38 +2,28 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `t6`.`ParentID_6`, - `t6`.`Value1`, `t6`.`ParentID`, + `t6`.`Value1`, + `t6`.`ParentID_1`, `t6`.`ChildID`, `t6`.`Any_1`, `t6`.`ChildID_1`, - `t6`.`ParentID_1`, - `t6`.`ChildID_2`, `t6`.`ParentID_2`, - `t6`.`ChildID_3`, + `t6`.`ChildID_2`, `t6`.`ParentID_3`, - `t6`.`ChildID_4`, + `t6`.`ChildID_3`, `t6`.`ParentID_4`, + `t6`.`ChildID_4`, + `t6`.`ParentID_5`, `t6`.`ChildID_5`, - `t6`.`ParentID_5` + `t6`.`ParentID_6` FROM ( SELECT DISTINCT - `c1_1`.`ParentID`, - `c1_1`.`ChildID`, - `t1`.`ChildID` as `ChildID_1`, - `t1`.`ParentID` as `ParentID_1`, - `t2`.`ChildID` as `ChildID_2`, - `t2`.`ParentID` as `ParentID_2`, - `t3`.`ChildID` as `ChildID_3`, - `t3`.`ParentID` as `ParentID_3`, - `t4`.`ChildID` as `ChildID_4`, - `t4`.`ParentID` as `ParentID_4`, - `t5`.`ChildID` as `ChildID_5`, - `t5`.`ParentID` as `ParentID_5`, - `p`.`ParentID` as `ParentID_6`, + `p`.`ParentID`, `p`.`Value1`, + `c1_1`.`ParentID` as `ParentID_1`, + `c1_1`.`ChildID`, CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as `Any_1` + END as `Any_1`, + `t1`.`ChildID` as `ChildID_1`, + `t1`.`ParentID` as `ParentID_2`, + `t2`.`ChildID` as `ChildID_2`, + `t2`.`ParentID` as `ParentID_3`, + `t3`.`ChildID` as `ChildID_3`, + `t3`.`ParentID` as `ParentID_4`, + `t4`.`ChildID` as `ChildID_4`, + `t4`.`ParentID` as `ParentID_5`, + `t5`.`ChildID` as `ChildID_5`, + `t5`.`ParentID` as `ParentID_6` FROM `Parent` `p` LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) `t5` ON 1=1 ) `t6` ORDER BY - `t6`.`ParentID_6` + `t6`.`ParentID` diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..aff7d7a53ab --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(MySqlConnector.8.0).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND Coalesce(`p`.`MiddleName`, 'None') = 'None' AND + `p`.`FirstName` = 'John' + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..6c07c7dbec4 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(MySqlConnector.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` = 1 + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0).sql index aff1dc4730e..6c07c7dbec4 100644 --- a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(MySqlConnector.8.0).sql @@ -2,17 +2,10 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND - `p`.`MiddleName` IS NULL AND - `p`.`MiddleName` IS NULL AND - `p`.`FirstName` IS NOT NULL AND - `p`.`FirstName` IS NOT NULL + `p`.`ParentID` = 1 diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0).sql index 58dad2b3db1..a4573c6d034 100644 --- a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(MySqlConnector.8.0).sql @@ -2,14 +2,10 @@ -- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 SELECT - `p`.`FirstName`, - `p`.`PersonID`, - `p`.`LastName`, - `p`.`MiddleName`, - `p`.`Gender` + `p`.`ParentID`, + `p`.`Value1` FROM - `Person` `p` + `Parent` `p` WHERE - `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND - NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + `p`.`ParentID` <> 1 diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..8eb21b7f300 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(MySqlConnector.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`Value1` = 1 + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..6b46e669889 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(MySqlConnector.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + (`p`.`Value1` <> 1 OR `p`.`Value1` IS NULL) + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..a4573c6d034 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(MySqlConnector.8.0).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`ParentID`, + `p`.`Value1` +FROM + `Parent` `p` +WHERE + `p`.`ParentID` <> 1 + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..7d9bad55f55 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(MySqlConnector.8.0).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..aff1dc4730e --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(MySqlConnector.8.0).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND + `p`.`MiddleName` IS NULL AND + `p`.`MiddleName` IS NULL AND + `p`.`FirstName` IS NOT NULL AND + `p`.`FirstName` IS NOT NULL + diff --git a/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.8.0).sql new file mode 100644 index 00000000000..58dad2b3db1 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(MySqlConnector.8.0).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `p`.`FirstName`, + `p`.`PersonID`, + `p`.`LastName`, + `p`.`MiddleName`, + `p`.`Gender` +FROM + `Person` `p` +WHERE + `p`.`PersonID` = 1 AND NOT (`p`.`MiddleName` IS NOT NULL OR `p`.`PersonID` = 2 OR `p`.`MiddleName` IS NOT NULL) AND + NOT (`p`.`FirstName` IS NULL OR `p`.`PersonID` = 2 OR `p`.`FirstName` IS NULL) + diff --git a/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0).sql index d333e098bd9..5654d054f09 100644 --- a/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(MySqlConnector.8.0).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT DISTINCT `c_2`.`ParentID`, @@ -26,9 +26,9 @@ FROM FROM `Child` `t1` ) `c_2` - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` LIMIT @take diff --git a/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0).sql index 0292478a289..82967f85007 100644 --- a/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(MySqlConnector.8.0).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0).sql index c41d5fdc048..59d562b1118 100644 --- a/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0).sql +++ b/MySqlConnector.8.0/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(MySqlConnector.8.0).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - `x`.`ParentID`, + `t3`.`ParentID`, `t2`.`ChildID` FROM - `Parent` `x` + `Parent` `t3` INNER JOIN ( SELECT `c_2`.`ParentID`, @@ -29,8 +29,8 @@ FROM ORDER BY `c_2`.`ParentID` LIMIT 10, 10 - ) `t2` ON `t2`.`ParentID` = `x`.`ParentID` + ) `t2` ON `t2`.`ParentID` = `t3`.`ParentID` ORDER BY - `x`.`ParentID` + `t3`.`ParentID` LIMIT @take diff --git a/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite.MS).sql b/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite.MS).sql index 15cce5f0137..0fef2d633ad 100644 --- a/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite.MS).sql +++ b/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite.MS).sql @@ -15,15 +15,15 @@ AS [p].[UnitPrice] > 10 ) SELECT - [t1].[ProductName], - [t1].[CategoryName], - [t1].[UnitPrice] + [p_1].[ProductName], + [p_1].[CategoryName], + [p_1].[UnitPrice] FROM - [ProductAndCategoryNamesOverTenDollars] [t1] + [ProductAndCategoryNamesOverTenDollars] [p_1] ORDER BY - [t1].[CategoryName], - [t1].[UnitPrice], - [t1].[ProductName] + [p_1].[CategoryName], + [p_1].[UnitPrice], + [p_1].[ProductName] BeforeExecute -- Northwind.SQLite.MS SQLite.MS SQLite diff --git a/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite.MS).sql b/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite.MS).sql index 5b58a473c4e..01e13b01dff 100644 --- a/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite.MS).sql +++ b/Northwind.SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite.MS).sql @@ -33,13 +33,13 @@ AS SELECT [c_2].[CategoryName], [c_2].[NumberOfProducts], - [p_2].[ProductName], - [p_2].[UnitPrice] + [t1].[ProductName], + [t1].[UnitPrice] FROM - [ProductsOverTenDollars] [p_2] - INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [p_2].[CategoryID] + [ProductsOverTenDollars] [t1] + INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [t1].[CategoryID] ORDER BY - [p_2].[ProductName] + [t1].[ProductName] BeforeExecute -- Northwind.SQLite.MS SQLite.MS SQLite diff --git a/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite).sql b/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite).sql index 76db2820116..7a43955e3a5 100644 --- a/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite).sql +++ b/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(Northwind.SQLite).sql @@ -15,15 +15,15 @@ AS [p].[UnitPrice] > 10 ) SELECT - [t1].[ProductName], - [t1].[CategoryName], - [t1].[UnitPrice] + [p_1].[ProductName], + [p_1].[CategoryName], + [p_1].[UnitPrice] FROM - [ProductAndCategoryNamesOverTenDollars] [t1] + [ProductAndCategoryNamesOverTenDollars] [p_1] ORDER BY - [t1].[CategoryName], - [t1].[UnitPrice], - [t1].[ProductName] + [p_1].[CategoryName], + [p_1].[UnitPrice], + [p_1].[ProductName] BeforeExecute -- Northwind.SQLite SQLite.Classic SQLite diff --git a/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite).sql b/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite).sql index 341c9acb303..fa330447128 100644 --- a/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite).sql +++ b/Northwind.SQLite/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(Northwind.SQLite).sql @@ -33,13 +33,13 @@ AS SELECT [c_2].[CategoryName], [c_2].[NumberOfProducts], - [p_2].[ProductName], - [p_2].[UnitPrice] + [t1].[ProductName], + [t1].[UnitPrice] FROM - [ProductsOverTenDollars] [p_2] - INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [p_2].[CategoryID] + [ProductsOverTenDollars] [t1] + INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [t1].[CategoryID] ORDER BY - [p_2].[ProductName] + [t1].[ProductName] BeforeExecute -- Northwind.SQLite SQLite.Classic SQLite diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed.LinqService).sql index 3c630e009f8..7b29c457619 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed.LinqService).sql index 545f0bb8105..04ed804a0f7 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed.LinqService).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed.LinqService).sql index c14cb556455..176038389b9 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed.LinqService).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed.LinqService).sql index 80eb5044e8e..e6e89c8bef3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed.LinqService).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed.LinqService).sql index 3ba377ad8b0..0a4255ffe5e 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed.LinqService).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed.LinqService).sql index 21d2137df02..7a6670bae80 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed.LinqService).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed.LinqService).sql index 556b93fc507..81b9e4542c4 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed.LinqService).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed.LinqService).sql index fa66f324fb6..3e9606970df 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed.LinqService).sql index 00a0d1143d9..622a2cd0523 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed.LinqService).sql index 0ae7cad29c4..d8d0395b21b 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed.LinqService).sql @@ -3,45 +3,12 @@ SELECT CASE - WHEN ( - SELECT - t1."ParentID" - FROM - ( - SELECT - c_1."ParentID" - FROM - "Child" c_1 - WHERE - c_1."ParentID" > 0 - ORDER BY - c_1."ParentID" - ) t1 - WHERE - ROWNUM <= 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - t1."ParentID" - FROM - ( - SELECT - c_1."ParentID" - FROM - "Child" c_1 - WHERE - c_1."ParentID" > 0 - ORDER BY - c_1."ParentID" - ) t1 - WHERE - ROWNUM <= 1 - ) + WHEN t2."ParentID_1" IS NULL THEN 0 + ELSE t2."ParentID_1" END, ( SELECT - t2."ParentID" + t3."ParentID" FROM ( SELECT @@ -52,13 +19,13 @@ SELECT c_2."ChildID" > -100 ORDER BY c_2."ParentID" - ) t2 + ) t3 WHERE ROWNUM <= 1 ), ( SELECT - t3."ChildID" + t4."ChildID" FROM ( SELECT @@ -69,12 +36,34 @@ SELECT c_3."ChildID" > -100 ORDER BY c_3."ParentID" - ) t3 + ) t4 WHERE ROWNUM <= 1 ) FROM - "Parent" p + ( + SELECT + p."ParentID", + ( + SELECT + t1."ParentID" + FROM + ( + SELECT + c_1."ParentID" + FROM + "Child" c_1 + WHERE + c_1."ParentID" > 0 + ORDER BY + c_1."ParentID" + ) t1 + WHERE + ROWNUM <= 1 + ) as "ParentID_1" + FROM + "Parent" p + ) t2 ORDER BY - p."ParentID" + t2."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed.LinqService,False).sql b/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed.LinqService,False).sql index 9be7394d183..c1bcea05b9c 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed.LinqService,False).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed.LinqService,False).sql @@ -123,22 +123,24 @@ BeforeExecute -- Oracle.11.Managed Oracle11 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.11.Managed Oracle11 diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed.LinqService).sql index 880a23e77c2..9c1bcab09ae 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed.LinqService).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed.LinqService).sql index ef675b76549..1d7f2df34dc 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed.LinqService).sql index 479849d0bdf..51cb18f71f3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed.LinqService).sql index 479849d0bdf..51cb18f71f3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,2).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,2).sql index c63e261246b..af66f4df1f3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,2).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,3).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,3).sql index 6f659e4d5ae..cb34dccedab 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,3).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,2).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,2).sql index c63e261246b..af66f4df1f3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,2).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,3).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,3).sql index 6f659e4d5ae..cb34dccedab 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,3).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed.LinqService,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,2).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,2).sql index 22e05d4f575..6523ac10ce9 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,2).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,3).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,3).sql index 75437a341f5..d68e55edf45 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,3).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,2).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,2).sql index 22e05d4f575..6523ac10ce9 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,2).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,3).sql b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,3).sql index 75437a341f5..d68e55edf45 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,3).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed.LinqService,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed.LinqService).sql index 7b9af5ce8af..98de471e06a 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed.LinqService).sql @@ -14,8 +14,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d."ParentID", - d."ChildID" + d."ChildID", + d."ParentID" FROM "Child" d WHERE diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,1).sql b/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,1).sql index 326b8f5f461..32c9f8ac382 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,1).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,2).sql b/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,2).sql index 69acd3e8327..39da103173b 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,2).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed.LinqService).sql index 729f7326401..292618ddbe6 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed.LinqService).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,14).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,14).sql index 74c109c75b7..290e8f1f49c 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,14).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,15).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,15).sql index 87e4d40c2c1..2712862139a 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,15).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,14).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,14).sql index b8d6e8348b7..b32b9560b22 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,14).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,15).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,15).sql index a779c336d11..1c21a8eee2d 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,15).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,14).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,14).sql index 3aefcf604f7..6790fa4e98c 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,14).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,15).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,15).sql index bd1941e9ff2..b8326d18e91 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,15).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,14).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,14).sql index 287ae244660..e95812f6ce4 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,14).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,15).sql b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,15).sql index 9ece1202afc..aaa438abdf0 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,15).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed.LinqService).sql index 5fe959af7b4..2dae668cee3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed.LinqService).sql index 233fc5a3a05..19e8233afe7 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed.LinqService).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed.LinqService).sql index 09afbf38f3e..d4667ca5601 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed.LinqService).sql index d28dc399dd5..960dc0b69db 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,False).sql b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,False).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,False).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,True).sql b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,True).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,True).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,False).sql b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,False).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,False).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,True).sql b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,True).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,True).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed.LinqService,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed.LinqService).sql index b2345be68e1..0d372d6e1e1 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed.LinqService).sql index 59ceeec37e3..4e878d09de9 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed.LinqService).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", ROW_NUMBER() OVER (PARTITION BY t1."AlertKey", t1."AlertCode", t1."CreationDate" ORDER BY t1."AlertKey") as "rn", t1."AlertKey", t1."AlertCode", diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed.LinqService).sql index 524f7707aa1..497ae9edf1d 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed.LinqService).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", ROW_NUMBER() OVER (PARTITION BY t1."AlertKey", t1."AlertCode", t1."CreationDate" ORDER BY t1."AlertKey") as "rn", t1."AlertKey", t1."AlertCode", diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed.LinqService).sql index f259cfb47b3..217efb0e3f2 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed.LinqService).sql index cc135b95132..3be2912b21e 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql index b2d104d7c8a..5166c20af14 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql index b94e1c94f86..7e5d0556eb7 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.11.Managed Oracle11 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql index af12b9fde09..d37b31d96a6 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql index 2e7add56d91..f244ee97646 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql index 6ee7cfa04ec..6d76c1f3edf 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql index 9247783f153..c3f23f05e6b 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.11.Managed Oracle11 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql index 9353907fdfc..b28242c9811 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql index 2e56dcc0fba..c49ecfc4493 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed.LinqService).sql index c18dce41f4e..a313ceacaf3 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed.LinqService).sql @@ -544,13 +544,13 @@ FROM FROM ( SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") ) t1 WHERE ROWNUM <= (:skip + :take) @@ -602,13 +602,13 @@ FROM FROM ( SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC ) t1 WHERE ROWNUM <= (:skip + :take) diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed.LinqService).sql index 1e438821c67..c2dec7145eb 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed.LinqService).sql @@ -544,13 +544,13 @@ FROM FROM ( SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) ) t1 WHERE ROWNUM <= (:skip + :take) diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed.LinqService).sql index 8ee14a89d9c..15343dfa185 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.11.Managed Oracle11 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed.LinqService).sql index 7b166981032..445949019a1 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed.LinqService).sql index 7b166981032..8d31a2997a0 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.11.Managed Oracle11 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed.LinqService).sql index ac93aac6164..96271cf95f5 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.11.Managed Oracle11 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed.LinqService).sql index 239e557d70a..9cbda643f5c 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Oracle.11.Managed Oracle11 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed.LinqService).sql index c50d36f42a7..3f1f7abb163 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - Nvl(t1."Value1", c_1."ChildID") + Coalesce(t1."Value1", c_1."ChildID") FROM "Child" c_1 LEFT JOIN ( diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed.LinqService).sql index 37665221151..bf5fd737c00 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..f8c8cd2a723 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,176 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.11.Managed Oracle11 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.11.Managed Oracle11 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.11.Managed Oracle11 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.11.Managed Oracle11 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..50a73e371a7 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..1bcf72f4c22 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed.LinqService).sql index a0d3f73ed77..1bcf72f4c22 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Oracle.11.Managed Oracle11 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed.LinqService).sql index 8ea4dfb8e05..0428d126a47 100644 --- a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Oracle.11.Managed Oracle11 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..e9ae4bab9ef --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..43bc5a8c395 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..0428d126a47 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..503c6f914e3 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..a0d3f73ed77 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.11.Managed.LinqService).sql new file mode 100644 index 00000000000..8ea4dfb8e05 --- /dev/null +++ b/Oracle.11.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.11.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed.LinqService).sql index fbd50bb6f70..a622b2143aa 100644 --- a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed.LinqService).sql @@ -4,15 +4,15 @@ DECLARE @take Int32 SET @take = 10 SELECT - t3."ParentID", - t3."ChildID" + t4."ParentID", + t4."ChildID" FROM ( SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -31,11 +31,11 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" - ) t3 + ) t4 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed.LinqService).sql index f41e5c0eed5..655284efe92 100644 --- a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed.LinqService).sql @@ -4,15 +4,15 @@ DECLARE @take Int32 SET @take = 10 SELECT - t4."ParentID", - t4."ChildID" + t5."ParentID", + t5."ChildID" FROM ( SELECT - x."ParentID", + t4."ParentID", t3."ChildID" FROM - "Parent" x + "Parent" t4 INNER JOIN ( SELECT t2."ParentID", @@ -41,10 +41,10 @@ FROM ) t2 WHERE ROWNUM <= 10 - ) t3 ON t3."ParentID" = x."ParentID" + ) t3 ON t3."ParentID" = t4."ParentID" ORDER BY - x."ParentID" - ) t4 + t4."ParentID" + ) t5 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed.LinqService).sql index 329014ca932..6359a5d7af1 100644 --- a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed.LinqService).sql @@ -4,15 +4,15 @@ DECLARE @take Int32 SET @take = 10 SELECT - t5."ParentID", - t5."ChildID" + t6."ParentID", + t6."ChildID" FROM ( SELECT - x."ParentID", + t5."ParentID", t4."ChildID" FROM - "Parent" x + "Parent" t5 INNER JOIN ( SELECT t3."ParentID", @@ -50,10 +50,10 @@ FROM ) t3 WHERE t3.RN > 10 - ) t4 ON t4."ParentID" = x."ParentID" + ) t4 ON t4."ParentID" = t5."ParentID" ORDER BY - x."ParentID" - ) t5 + t5."ParentID" + ) t6 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed.LinqService).sql index cc21f01303d..f79a05438df 100644 --- a/Oracle.11.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed.LinqService).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.11.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed.LinqService).sql index 7eec76a73eb..0c97c189cf1 100644 --- a/Oracle.11.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed.LinqService).sql @@ -88,7 +88,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.11.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed.LinqService).sql b/Oracle.11.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed.LinqService).sql index 6fe3cec3094..33edcc79454 100644 --- a/Oracle.11.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed.LinqService).sql +++ b/Oracle.11.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed.LinqService).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.11.Managed).sql index f74f9566cdc..bd1475311fa 100644 --- a/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.11.Managed).sql @@ -4,29 +4,29 @@ DECLARE @take Int32 SET @take = 100 SELECT - t1."ParentID", - t1.COUNT_1, - t1."c1" + t2."key_1", + t2.COUNT_1, + t2."window_1" FROM ( SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC - ) t1 + t1."key_1" DESC + ) t2 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.11.Managed).sql index f74f9566cdc..bd1475311fa 100644 --- a/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.11.Managed).sql @@ -4,29 +4,29 @@ DECLARE @take Int32 SET @take = 100 SELECT - t1."ParentID", - t1.COUNT_1, - t1."c1" + t2."key_1", + t2.COUNT_1, + t2."window_1" FROM ( SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC - ) t1 + t1."key_1" DESC + ) t2 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.11.Managed).sql index 125ca0e0076..a7901754128 100644 --- a/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.11.Managed).sql @@ -4,29 +4,29 @@ DECLARE @take Int32 SET @take = 100 SELECT - t1."ParentID", - t1.COUNT_1, - t1."c1" + t2."key_1", + t2.COUNT_1, + t2."window_1" FROM ( SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC - ) t1 + t1."key_1" DESC + ) t2 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed).sql index 3c630e009f8..7b29c457619 100644 --- a/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed).sql index 545f0bb8105..04ed804a0f7 100644 --- a/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.11.Managed).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed).sql index c14cb556455..176038389b9 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.11.Managed).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed).sql index 80eb5044e8e..e6e89c8bef3 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.11.Managed).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed).sql index 3ba377ad8b0..0a4255ffe5e 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.11.Managed).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed).sql index 21d2137df02..7a6670bae80 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.11.Managed).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed).sql index 556b93fc507..81b9e4542c4 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.11.Managed).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed).sql index fa66f324fb6..3e9606970df 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.11.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed).sql index 00a0d1143d9..622a2cd0523 100644 --- a/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.11.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.11.Managed/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed).sql index 0ae7cad29c4..d8d0395b21b 100644 --- a/Oracle.11.Managed/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(Oracle.11.Managed).sql @@ -3,45 +3,12 @@ SELECT CASE - WHEN ( - SELECT - t1."ParentID" - FROM - ( - SELECT - c_1."ParentID" - FROM - "Child" c_1 - WHERE - c_1."ParentID" > 0 - ORDER BY - c_1."ParentID" - ) t1 - WHERE - ROWNUM <= 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - t1."ParentID" - FROM - ( - SELECT - c_1."ParentID" - FROM - "Child" c_1 - WHERE - c_1."ParentID" > 0 - ORDER BY - c_1."ParentID" - ) t1 - WHERE - ROWNUM <= 1 - ) + WHEN t2."ParentID_1" IS NULL THEN 0 + ELSE t2."ParentID_1" END, ( SELECT - t2."ParentID" + t3."ParentID" FROM ( SELECT @@ -52,13 +19,13 @@ SELECT c_2."ChildID" > -100 ORDER BY c_2."ParentID" - ) t2 + ) t3 WHERE ROWNUM <= 1 ), ( SELECT - t3."ChildID" + t4."ChildID" FROM ( SELECT @@ -69,12 +36,34 @@ SELECT c_3."ChildID" > -100 ORDER BY c_3."ParentID" - ) t3 + ) t4 WHERE ROWNUM <= 1 ) FROM - "Parent" p + ( + SELECT + p."ParentID", + ( + SELECT + t1."ParentID" + FROM + ( + SELECT + c_1."ParentID" + FROM + "Child" c_1 + WHERE + c_1."ParentID" > 0 + ORDER BY + c_1."ParentID" + ) t1 + WHERE + ROWNUM <= 1 + ) as "ParentID_1" + FROM + "Parent" p + ) t2 ORDER BY - p."ParentID" + t2."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed,False).sql b/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed,False).sql index 72d96917b28..2c4a8a3de17 100644 --- a/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed,False).sql +++ b/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.11.Managed,False).sql @@ -45,22 +45,24 @@ BeforeExecute -- Oracle.11.Managed Oracle11 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.11.Managed Oracle11 diff --git a/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed).sql index 880a23e77c2..9c1bcab09ae 100644 --- a/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.11.Managed).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed).sql index ef675b76549..1d7f2df34dc 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed).sql index 479849d0bdf..51cb18f71f3 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed).sql index 479849d0bdf..51cb18f71f3 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,2).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,2).sql index c63e261246b..af66f4df1f3 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,2).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,3).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,3).sql index 6f659e4d5ae..cb34dccedab 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,3).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,2).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,2).sql index c63e261246b..af66f4df1f3 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,2).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,3).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,3).sql index 6f659e4d5ae..cb34dccedab 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,3).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.11.Managed,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,2).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,2).sql index 22e05d4f575..6523ac10ce9 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,2).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,3).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,3).sql index 75437a341f5..d68e55edf45 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,3).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,2).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,2).sql index 22e05d4f575..6523ac10ce9 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,2).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,3).sql b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,3).sql index 75437a341f5..d68e55edf45 100644 --- a/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,3).sql +++ b/Oracle.11.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.11.Managed,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.11.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed).sql index c4916a4094c..c44ba169e54 100644 --- a/Oracle.11.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.11.Managed).sql @@ -16,8 +16,8 @@ FROM ) m_1 INNER JOIN ( SELECT DISTINCT - d."ParentID", - d."ChildID" + d."ChildID", + d."ParentID" FROM "Child" d WHERE diff --git a/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,1).sql b/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,1).sql index 326b8f5f461..32c9f8ac382 100644 --- a/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,1).sql +++ b/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,2).sql b/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,2).sql index 69acd3e8327..39da103173b 100644 --- a/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,2).sql +++ b/Oracle.11.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.11.Managed,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.11.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed).sql index 729f7326401..292618ddbe6 100644 --- a/Oracle.11.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.11.Managed).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,14).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,14).sql index ad73f451cc9..350cb606292 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,14).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,15).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,15).sql index d7a9b6b1316..03619538d48 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,15).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.11.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,14).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,14).sql index 65b6ab756eb..ebfcf50256a 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,14).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,15).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,15).sql index 4606dd0ae82..8752389d120 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,15).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.11.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,14).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,14).sql index 3efe7f270ed..0dcb9f236f7 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,14).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,15).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,15).sql index 873a8a80dd5..cc6d0c5e0e2 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,15).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.11.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,14).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,14).sql index f61f5c1307a..1e07e9eec64 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,14).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,15).sql b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,15).sql index 6b7533f26ca..92955cb06b4 100644 --- a/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,15).sql +++ b/Oracle.11.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.11.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed).sql index 5fe959af7b4..2dae668cee3 100644 --- a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed).sql index 233fc5a3a05..19e8233afe7 100644 --- a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.11.Managed).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed).sql index 09afbf38f3e..d4667ca5601 100644 --- a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed).sql index d28dc399dd5..960dc0b69db 100644 --- a/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.11.Managed).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,False).sql b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,False).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,False).sql +++ b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,True).sql b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,True).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,True).sql +++ b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,False).sql b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,False).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,False).sql +++ b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,True).sql b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,True).sql index ea02955ba98..a9ba60434f5 100644 --- a/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,True).sql +++ b/Oracle.11.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.11.Managed,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed).sql index b2345be68e1..0d372d6e1e1 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.11.Managed).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed).sql index 59ceeec37e3..4e878d09de9 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.11.Managed).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", ROW_NUMBER() OVER (PARTITION BY t1."AlertKey", t1."AlertCode", t1."CreationDate" ORDER BY t1."AlertKey") as "rn", t1."AlertKey", t1."AlertCode", diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed).sql index 524f7707aa1..497ae9edf1d 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.11.Managed).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1", ROW_NUMBER() OVER (PARTITION BY t1."AlertKey", t1."AlertCode", t1."CreationDate" ORDER BY t1."AlertKey") as "rn", t1."AlertKey", t1."AlertCode", diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed).sql index f259cfb47b3..217efb0e3f2 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed).sql index cc135b95132..3be2912b21e 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql index b2d104d7c8a..5166c20af14 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql index b94e1c94f86..7e5d0556eb7 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.11.Managed Oracle11 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql index af12b9fde09..d37b31d96a6 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql index 2e7add56d91..f244ee97646 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql index 6ee7cfa04ec..6d76c1f3edf 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql index 9247783f153..c3f23f05e6b 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.11.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.11.Managed Oracle11 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql index 9353907fdfc..b28242c9811 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.11.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql index 2e56dcc0fba..c49ecfc4493 100644 --- a/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.11.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed).sql index b4a76e431c8..71e70b91145 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.11.Managed).sql @@ -100,13 +100,13 @@ FROM FROM ( SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") ) t1 WHERE ROWNUM <= (:skip + :take) @@ -158,13 +158,13 @@ FROM FROM ( SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC ) t1 WHERE ROWNUM <= (:skip + :take) diff --git a/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed).sql index cc8829d49bd..04a3d746dea 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.11.Managed).sql @@ -100,13 +100,13 @@ FROM FROM ( SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) ) t1 WHERE ROWNUM <= (:skip + :take) diff --git a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed).sql index 8ee14a89d9c..15343dfa185 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.11.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.11.Managed Oracle11 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed).sql index 7b166981032..445949019a1 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.11.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed).sql index 7b166981032..8d31a2997a0 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.11.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.11.Managed Oracle11 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed).sql index ac93aac6164..96271cf95f5 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.11.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.11.Managed Oracle11 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed).sql index 239e557d70a..9cbda643f5c 100644 --- a/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.11.Managed).sql @@ -2,17 +2,21 @@ -- Oracle.11.Managed Oracle11 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed).sql index c50d36f42a7..3f1f7abb163 100644 --- a/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - Nvl(t1."Value1", c_1."ChildID") + Coalesce(t1."Value1", c_1."ChildID") FROM "Child" c_1 LEFT JOIN ( diff --git a/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed).sql index 37665221151..bf5fd737c00 100644 --- a/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.11.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.11.Managed Oracle11 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.11.Managed).sql new file mode 100644 index 00000000000..3a23eabb79f --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.11.Managed).sql @@ -0,0 +1,82 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +INSERT ALL + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (1,10,NULL,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (2,NULL,20,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (3,NULL,NULL,30) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (4,NULL,NULL,NULL) +SELECT * FROM dual + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.11.Managed Oracle11 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.11.Managed).sql index a9cd3c28666..610372b8e8b 100644 --- a/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.11.Managed).sql @@ -64,16 +64,16 @@ SELECT FROM ( SELECT - Nvl(t1."EnumNullable", t1."Enum") as "Converted1", + Coalesce(t1."EnumNullable", t1."Enum") as "Converted1", t1."Value1" as "Converted2" FROM "ValueConversion" t1 ) t2 UNION SELECT - Nvl(t1_1."EnumNullable", t1_1."Enum"), + Coalesce(t1_1."EnumNullable", t1_1."Enum"), t1_1."Value1", - Nvl(t1_1."EnumNullable", t1_1."Enum") + Coalesce(t1_1."EnumNullable", t1_1."Enum") FROM "ValueConversion" t1_1 diff --git a/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.11.Managed).sql index 9f40fe88d2d..aab29863d8b 100644 --- a/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.11.Managed).sql @@ -58,7 +58,7 @@ BeforeExecute -- Oracle.11.Managed Oracle11 SELECT - Nvl(t1."EnumNullable", t1."Enum") + Coalesce(t1."EnumNullable", t1."Enum") FROM "ValueConversion" t1 diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.11.Managed).sql new file mode 100644 index 00000000000..50a73e371a7 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.11.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.11.Managed).sql new file mode 100644 index 00000000000..1bcf72f4c22 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.11.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed).sql index a0d3f73ed77..1bcf72f4c22 100644 --- a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.11.Managed).sql @@ -2,17 +2,10 @@ -- Oracle.11.Managed Oracle11 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed).sql index 8ea4dfb8e05..0428d126a47 100644 --- a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.11.Managed).sql @@ -2,14 +2,10 @@ -- Oracle.11.Managed Oracle11 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.11.Managed).sql new file mode 100644 index 00000000000..e9ae4bab9ef --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.11.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.11.Managed).sql new file mode 100644 index 00000000000..43bc5a8c395 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.11.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.11.Managed).sql new file mode 100644 index 00000000000..0428d126a47 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.11.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.11.Managed).sql new file mode 100644 index 00000000000..503c6f914e3 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.11.Managed).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.11.Managed).sql new file mode 100644 index 00000000000..a0d3f73ed77 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.11.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.11.Managed).sql new file mode 100644 index 00000000000..8ea4dfb8e05 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.11.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.11.Managed Oracle11 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed).sql index fbd50bb6f70..a622b2143aa 100644 --- a/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.11.Managed).sql @@ -4,15 +4,15 @@ DECLARE @take Int32 SET @take = 10 SELECT - t3."ParentID", - t3."ChildID" + t4."ParentID", + t4."ChildID" FROM ( SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -31,11 +31,11 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" - ) t3 + ) t4 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed).sql index f41e5c0eed5..655284efe92 100644 --- a/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.11.Managed).sql @@ -4,15 +4,15 @@ DECLARE @take Int32 SET @take = 10 SELECT - t4."ParentID", - t4."ChildID" + t5."ParentID", + t5."ChildID" FROM ( SELECT - x."ParentID", + t4."ParentID", t3."ChildID" FROM - "Parent" x + "Parent" t4 INNER JOIN ( SELECT t2."ParentID", @@ -41,10 +41,10 @@ FROM ) t2 WHERE ROWNUM <= 10 - ) t3 ON t3."ParentID" = x."ParentID" + ) t3 ON t3."ParentID" = t4."ParentID" ORDER BY - x."ParentID" - ) t4 + t4."ParentID" + ) t5 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed).sql index 329014ca932..6359a5d7af1 100644 --- a/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.11.Managed).sql @@ -4,15 +4,15 @@ DECLARE @take Int32 SET @take = 10 SELECT - t5."ParentID", - t5."ChildID" + t6."ParentID", + t6."ChildID" FROM ( SELECT - x."ParentID", + t5."ParentID", t4."ChildID" FROM - "Parent" x + "Parent" t5 INNER JOIN ( SELECT t3."ParentID", @@ -50,10 +50,10 @@ FROM ) t3 WHERE t3.RN > 10 - ) t4 ON t4."ParentID" = x."ParentID" + ) t4 ON t4."ParentID" = t5."ParentID" ORDER BY - x."ParentID" - ) t5 + t5."ParentID" + ) t6 WHERE ROWNUM <= :take diff --git a/Oracle.11.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed).sql index cc21f01303d..f79a05438df 100644 --- a/Oracle.11.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.11.Managed).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.11.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed).sql index 57db4e7f51b..0f70a8790c6 100644 --- a/Oracle.11.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.11.Managed).sql @@ -60,7 +60,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.11.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed).sql index 6fe3cec3094..33edcc79454 100644 --- a/Oracle.11.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed).sql +++ b/Oracle.11.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.11.Managed).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed.LinqService).sql index f9e0e7e4d42..b7a1f9dec7a 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed.LinqService).sql index 3c024e1c0ac..a1a5060e10b 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed.LinqService).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed.LinqService).sql index 9b9cc243277..73d9404862c 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed.LinqService).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed.LinqService).sql index 1ccad9acedf..ab471b3e98c 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed.LinqService).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed.LinqService).sql index ac81172d2af..ddfa9202947 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed.LinqService).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed.LinqService).sql index 99a4caeac2f..4b14783dc37 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed.LinqService).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed.LinqService).sql index bc52ce44480..806c803b3f8 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed.LinqService).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed.LinqService).sql index 6e27c0d46ae..f6b8f3ea667 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed.LinqService).sql index f0d3da2aafd..a01effecc86 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed.LinqService,False).sql b/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed.LinqService,False).sql index 3a6697454b7..26d8947cb0a 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed.LinqService,False).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed.LinqService,False).sql @@ -123,22 +123,24 @@ BeforeExecute -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.12.Managed Oracle.Managed Oracle12 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed.LinqService).sql index 386489e13a4..326d71a92ee 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed.LinqService).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed.LinqService).sql index 07e3f8466fe..d03fcd9b96c 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed.LinqService).sql index 7d80e828ee1..828688528dc 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed.LinqService).sql index 7d80e828ee1..828688528dc 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,2).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,2).sql index 137adfb1616..314734221d1 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,2).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,3).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,3).sql index c0a4db471a8..d7904e24e83 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,3).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,2).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,2).sql index 137adfb1616..314734221d1 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,2).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,3).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,3).sql index c0a4db471a8..d7904e24e83 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,3).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed.LinqService,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,2).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,2).sql index b0cde129948..9f5006250aa 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,2).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,3).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,3).sql index e19a63ccd2c..0edd8fbd993 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,3).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,2).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,2).sql index b0cde129948..9f5006250aa 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,2).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,3).sql b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,3).sql index e19a63ccd2c..0edd8fbd993 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,3).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed.LinqService,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed.LinqService).sql index 92acbd98457..e314d62d856 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,1).sql b/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,1).sql index ab80fcc1e87..9edddeaa599 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,1).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,2).sql b/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,2).sql index 685ea65f498..e285f37c12f 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,2).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed.LinqService).sql index 4d1c680785a..f73d6fb5422 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed.LinqService).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,14).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,14).sql index 8dff0008aa6..a47c17639cf 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,14).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,15).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,15).sql index 5f675770079..01fd744b818 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,15).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,14).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,14).sql index aa40094c554..9c40d20b993 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,14).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,15).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,15).sql index d483d0b00e3..21997b0c3b8 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,15).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,14).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,14).sql index 3556b2c4f5b..d59bd3343fc 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,14).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,15).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,15).sql index dd14b33f370..ff4eb9938fa 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,15).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,14).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,14).sql index 4de3514c496..9655d2c0ca6 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,14).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,15).sql b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,15).sql index fd4d80deba8..051b9507c3e 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,15).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed.LinqService).sql index 025c72ccc1f..ba512ed22b7 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed.LinqService).sql index 9be6eed9fbc..a36756f2bc9 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed.LinqService).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed.LinqService).sql index c7fa0d9f564..cd33c3cbb9b 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed.LinqService).sql index 6478e67bdd3..68776db31b3 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,False).sql b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,False).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,False).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,True).sql b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,True).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,True).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,False).sql b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,False).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,False).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,True).sql b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,True).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,True).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed.LinqService,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed.LinqService).sql index f799af32cdb..6acb82c69f1 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed.LinqService).sql index 2644d410454..462211ecabd 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed.LinqService).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed.LinqService).sql index b361f4d39c5..5fbbe889609 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed.LinqService).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed.LinqService).sql index df5229d843c..b61a7764f6b 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed.LinqService).sql index d5900cdc8d2..4868ee183a8 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql index eb02b733dbf..ce7d3d01f9f 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql index deec5819f3a..6eb46dda1b0 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql index ab55b9cd062..939336bfa70 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql index ecf62c23790..3f2173b3a0c 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql index 98cca0889ff..bfe83a0861b 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql index 4278923214f..5ef1f25fd7c 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql index e4ac25bf96d..087a5ac23aa 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql index f6735366061..92e6e2c9b74 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed.LinqService).sql index 7c1a8b3b9cc..20d4b2673ec 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -551,13 +551,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed.LinqService).sql index af1cfa45187..cb709b6234b 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed.LinqService).sql index ce6a4e486b2..b6cfca69dcf 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed.LinqService).sql index 23c60ba4a74..430a3cdce6e 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed.LinqService).sql index 23c60ba4a74..0614f26faac 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed.LinqService).sql index 3f1409180ec..6165da7c5f5 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed.LinqService).sql index 165a5a530e2..2faa6e7811d 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed.LinqService).sql index 923b912dec2..6fcac97a336 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed.LinqService).sql index ec4de5b99f2..82fbbe37e5d 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..f5ccdcf13ec --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,176 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..eebe085b281 --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..36846d57f41 --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed.LinqService).sql index 849ac32f9ec..36846d57f41 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed.LinqService).sql index e56430be228..e998ebe0824 100644 --- a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..c706c5015eb --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..4a54c03b9ea --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..e998ebe0824 --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..0b51d129a27 --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..849ac32f9ec --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.12.Managed.LinqService).sql new file mode 100644 index 00000000000..e56430be228 --- /dev/null +++ b/Oracle.12.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.12.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed.LinqService).sql index 33ab6cc64bd..c081e262c44 100644 --- a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed.LinqService).sql index 03a7dafeeb8..1110a415c02 100644 --- a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed.LinqService).sql index a3089c689cd..63b2a3543ef 100644 --- a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed.LinqService).sql index eae12d0256f..693b72f00cd 100644 --- a/Oracle.12.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed.LinqService).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.12.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed.LinqService).sql index dd13410e2c6..c56c74dc449 100644 --- a/Oracle.12.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed.LinqService).sql @@ -88,7 +88,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.12.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed.LinqService).sql b/Oracle.12.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed.LinqService).sql index b7c9089c2c1..abcbf368964 100644 --- a/Oracle.12.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed.LinqService).sql +++ b/Oracle.12.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed.LinqService).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.12.Managed).sql index 4a08aef563a..dc820fd669d 100644 --- a/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.12.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.12.Managed).sql index 4a08aef563a..dc820fd669d 100644 --- a/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.12.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.12.Managed).sql index e98f14132d2..2c28b08d6eb 100644 --- a/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.12.Managed).sql @@ -4,21 +4,21 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed).sql index f9e0e7e4d42..b7a1f9dec7a 100644 --- a/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed).sql index 3c024e1c0ac..a1a5060e10b 100644 --- a/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.12.Managed).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed).sql index 9b9cc243277..73d9404862c 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.12.Managed).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed).sql index 1ccad9acedf..ab471b3e98c 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.12.Managed).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed).sql index ac81172d2af..ddfa9202947 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.12.Managed).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed).sql index 99a4caeac2f..4b14783dc37 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.12.Managed).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed).sql index bc52ce44480..806c803b3f8 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.12.Managed).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed).sql index 6e27c0d46ae..f6b8f3ea667 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.12.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed).sql index f0d3da2aafd..a01effecc86 100644 --- a/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.12.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed,False).sql b/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed,False).sql index 0a4583a7f49..bfbfa4dbe41 100644 --- a/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed,False).sql +++ b/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.12.Managed,False).sql @@ -45,22 +45,24 @@ BeforeExecute -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.12.Managed Oracle.Managed Oracle12 diff --git a/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed).sql index 386489e13a4..326d71a92ee 100644 --- a/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.12.Managed).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed).sql index 07e3f8466fe..d03fcd9b96c 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed).sql index 7d80e828ee1..828688528dc 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed).sql index 7d80e828ee1..828688528dc 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,2).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,2).sql index 137adfb1616..314734221d1 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,2).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,3).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,3).sql index c0a4db471a8..d7904e24e83 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,3).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,2).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,2).sql index 137adfb1616..314734221d1 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,2).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,3).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,3).sql index c0a4db471a8..d7904e24e83 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,3).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.12.Managed,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,2).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,2).sql index b0cde129948..9f5006250aa 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,2).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,3).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,3).sql index e19a63ccd2c..0edd8fbd993 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,3).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,2).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,2).sql index b0cde129948..9f5006250aa 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,2).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,3).sql b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,3).sql index e19a63ccd2c..0edd8fbd993 100644 --- a/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,3).sql +++ b/Oracle.12.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.12.Managed,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.12.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed).sql index 92acbd98457..e314d62d856 100644 --- a/Oracle.12.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.12.Managed).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,1).sql b/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,1).sql index ab80fcc1e87..9edddeaa599 100644 --- a/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,1).sql +++ b/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,2).sql b/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,2).sql index 685ea65f498..e285f37c12f 100644 --- a/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,2).sql +++ b/Oracle.12.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.12.Managed,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.12.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed).sql index 4d1c680785a..f73d6fb5422 100644 --- a/Oracle.12.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.12.Managed).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,14).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,14).sql index 20713c59371..4316cb336ad 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,14).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,15).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,15).sql index a7f1518e36c..93d4fc2a914 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,15).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.12.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,14).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,14).sql index 632ace10091..e8aafe4e988 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,14).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,15).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,15).sql index 738296d85c2..2601254285a 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,15).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.12.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,14).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,14).sql index 8fc4208eb83..b61e871951f 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,14).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,15).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,15).sql index 97924e4b235..990a876ff28 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,15).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.12.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,14).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,14).sql index 55bd19a0f56..cbd0da3cb72 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,14).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,15).sql b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,15).sql index 4175ef5a8e0..ab7e0e7f194 100644 --- a/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,15).sql +++ b/Oracle.12.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.12.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed).sql index 025c72ccc1f..ba512ed22b7 100644 --- a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed).sql index 9be6eed9fbc..a36756f2bc9 100644 --- a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.12.Managed).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed).sql index c7fa0d9f564..cd33c3cbb9b 100644 --- a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed).sql index 6478e67bdd3..68776db31b3 100644 --- a/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.12.Managed).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,False).sql b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,False).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,False).sql +++ b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,True).sql b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,True).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,True).sql +++ b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,False).sql b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,False).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,False).sql +++ b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,True).sql b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,True).sql index ff07fdbe74c..88fb09666b2 100644 --- a/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,True).sql +++ b/Oracle.12.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.12.Managed,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed).sql index f799af32cdb..6acb82c69f1 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.12.Managed).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed).sql index 2644d410454..462211ecabd 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.12.Managed).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed).sql index b361f4d39c5..5fbbe889609 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.12.Managed).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed).sql index df5229d843c..b61a7764f6b 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed).sql index d5900cdc8d2..4868ee183a8 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql index eb02b733dbf..ce7d3d01f9f 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql index deec5819f3a..6eb46dda1b0 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql index ab55b9cd062..939336bfa70 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql index ecf62c23790..3f2173b3a0c 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql index 98cca0889ff..bfe83a0861b 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql index 4278923214f..5ef1f25fd7c 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.12.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql index e4ac25bf96d..087a5ac23aa 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.12.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql index f6735366061..92e6e2c9b74 100644 --- a/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.12.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed).sql index d9db6790018..f0dc6074786 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.12.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -107,13 +107,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed).sql index e7322c1d8f1..221186cb8b2 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.12.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed).sql index ce6a4e486b2..b6cfca69dcf 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.12.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed).sql index 23c60ba4a74..430a3cdce6e 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.12.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed).sql index 23c60ba4a74..0614f26faac 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.12.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed).sql index 3f1409180ec..6165da7c5f5 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.12.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed).sql index 165a5a530e2..2faa6e7811d 100644 --- a/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.12.Managed).sql @@ -2,17 +2,21 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed).sql index 923b912dec2..6fcac97a336 100644 --- a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed).sql index ec4de5b99f2..82fbbe37e5d 100644 --- a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.12.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.12.Managed).sql new file mode 100644 index 00000000000..6aa63a10488 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.12.Managed).sql @@ -0,0 +1,82 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +INSERT ALL + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (1,10,NULL,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (2,NULL,20,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (3,NULL,NULL,30) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (4,NULL,NULL,NULL) +SELECT * FROM dual + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.12.Managed).sql index a6285d6855b..eba8ebe5bb5 100644 --- a/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.12.Managed).sql @@ -2,38 +2,28 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p OUTER APPLY ( @@ -110,5 +110,5 @@ FROM ) t5 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.12.Managed).sql index ee1ed12a198..385405422f1 100644 --- a/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.12.Managed).sql @@ -64,16 +64,16 @@ SELECT FROM ( SELECT - Nvl(t1."EnumNullable", t1."Enum") as "Converted1", + Coalesce(t1."EnumNullable", t1."Enum") as "Converted1", t1."Value1" as "Converted2" FROM "ValueConversion" t1 ) t2 UNION SELECT - Nvl(t1_1."EnumNullable", t1_1."Enum"), + Coalesce(t1_1."EnumNullable", t1_1."Enum"), t1_1."Value1", - Nvl(t1_1."EnumNullable", t1_1."Enum") + Coalesce(t1_1."EnumNullable", t1_1."Enum") FROM "ValueConversion" t1_1 diff --git a/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.12.Managed).sql index 60bec68067f..3f1b7b99f7d 100644 --- a/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.12.Managed).sql @@ -58,7 +58,7 @@ BeforeExecute -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - Nvl(t1."EnumNullable", t1."Enum") + Coalesce(t1."EnumNullable", t1."Enum") FROM "ValueConversion" t1 diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.12.Managed).sql new file mode 100644 index 00000000000..eebe085b281 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.12.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.12.Managed).sql new file mode 100644 index 00000000000..36846d57f41 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.12.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed).sql index 849ac32f9ec..36846d57f41 100644 --- a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.12.Managed).sql @@ -2,17 +2,10 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed).sql index e56430be228..e998ebe0824 100644 --- a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.12.Managed).sql @@ -2,14 +2,10 @@ -- Oracle.12.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.12.Managed).sql new file mode 100644 index 00000000000..c706c5015eb --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.12.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.12.Managed).sql new file mode 100644 index 00000000000..4a54c03b9ea --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.12.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.12.Managed).sql new file mode 100644 index 00000000000..e998ebe0824 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.12.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.12.Managed).sql new file mode 100644 index 00000000000..0b51d129a27 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.12.Managed).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.12.Managed).sql new file mode 100644 index 00000000000..849ac32f9ec --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.12.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.12.Managed).sql new file mode 100644 index 00000000000..e56430be228 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.12.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed).sql index 33ab6cc64bd..c081e262c44 100644 --- a/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.12.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed).sql index 03a7dafeeb8..1110a415c02 100644 --- a/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.12.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed).sql index a3089c689cd..63b2a3543ef 100644 --- a/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.12.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.12.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed).sql index eae12d0256f..693b72f00cd 100644 --- a/Oracle.12.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.12.Managed).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.12.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed).sql index eb3c870054a..3ff34283282 100644 --- a/Oracle.12.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.12.Managed).sql @@ -60,7 +60,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.12.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed).sql index b7c9089c2c1..abcbf368964 100644 --- a/Oracle.12.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed).sql +++ b/Oracle.12.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.12.Managed).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed.LinqService).sql index 3893c462757..125c9ca4dfe 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed.LinqService).sql index f2febbd9b35..2f9ff7ea29a 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed.LinqService).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed.LinqService).sql index c37a00a7d54..bfcba882053 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed.LinqService).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed.LinqService).sql index eac160904f9..7a30e245bc0 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed.LinqService).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed.LinqService).sql index aa7e82d6698..fc8e3afd77a 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed.LinqService).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed.LinqService).sql index 16aa094b645..c2ed2069996 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed.LinqService).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed.LinqService).sql index 287140d88b8..3cc90bd8c65 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed.LinqService).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed.LinqService).sql index a5e02fd6111..522f3904d46 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed.LinqService).sql index 119b765ba97..67f3157c177 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed.LinqService,False).sql b/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed.LinqService,False).sql index bc591d2497a..ec1afa99744 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed.LinqService,False).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed.LinqService,False).sql @@ -123,22 +123,24 @@ BeforeExecute -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.18.Managed Oracle.Managed Oracle12 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed.LinqService).sql index e633fddb254..feb6b9d170e 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed.LinqService).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed.LinqService).sql index 18600f412ed..aff45adcf80 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed.LinqService).sql index 28843e2203b..2cbec61a3cc 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed.LinqService).sql index 28843e2203b..2cbec61a3cc 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,2).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,2).sql index 8a68cb61bb9..c3e76d758b4 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,2).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,3).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,3).sql index 505f7613581..9ebf6c2aec0 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,3).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,2).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,2).sql index 8a68cb61bb9..c3e76d758b4 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,2).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,3).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,3).sql index 505f7613581..9ebf6c2aec0 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,3).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed.LinqService,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,2).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,2).sql index 9906496f36d..89d132c5e77 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,2).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,3).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,3).sql index 2ca91107522..c387b6cf5cb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,3).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,2).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,2).sql index 9906496f36d..89d132c5e77 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,2).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,3).sql b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,3).sql index 2ca91107522..c387b6cf5cb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,3).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed.LinqService,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed.LinqService).sql index d5a63a3f80a..99e231a43b7 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,1).sql b/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,1).sql index 809002f14ba..ba68122e48b 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,1).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,2).sql b/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,2).sql index 34df6ce985f..fbc64ba61f9 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,2).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed.LinqService).sql index 3807ebc1c93..673588547fe 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed.LinqService).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,14).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,14).sql index 3ad11210d52..545e9f8959a 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,14).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,15).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,15).sql index f43659e91da..3d8d4b5563b 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,15).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,14).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,14).sql index 3e4f977bea5..6c7ab5ac616 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,14).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,15).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,15).sql index a844043b854..939ef85037d 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,15).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,14).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,14).sql index e918352b85d..cfd26a37b56 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,14).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,15).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,15).sql index d98800d2cb7..09c603f8585 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,15).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,14).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,14).sql index 0b875bfb3d8..2d52201fdcb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,14).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,15).sql b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,15).sql index d5c435509b9..46ff354e375 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,15).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed.LinqService).sql index 4cb568ccb36..8f9026ded8c 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed.LinqService).sql index 7f8037fa42e..57b0eabb320 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed.LinqService).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed.LinqService).sql index b637d6de0bd..58f9094c5a5 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed.LinqService).sql index 017e99a01e7..7910c704770 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,False).sql b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,False).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,False).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,True).sql b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,True).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,True).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,False).sql b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,False).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,False).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,True).sql b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,True).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,True).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed.LinqService,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed.LinqService).sql index defc76e7d87..767281aefe6 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed.LinqService).sql index 22a908cf2ca..d5fd6da8188 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed.LinqService).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed.LinqService).sql index 6c853e234f3..671597f3c98 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed.LinqService).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed.LinqService).sql index 6cb17ddb47c..f560a6c2913 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed.LinqService).sql index c9faadccc6b..ef882b54aa0 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql index 8e4973867e3..5171c867f8d 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql index 9a2685fcc1d..80ac9141325 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql index f13bf3964a9..99e7ba4f4e1 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql index fccb91e4348..6e20a0766ba 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql index 59ca1a0e950..0567d85beea 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql index 10e4b3bccbf..d7b35ca1d68 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql index c78378aff8e..ddb2ec686ce 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql index 93a70e3c749..183ff938636 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed.LinqService).sql index 682af120e94..5cb89514377 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -551,13 +551,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed.LinqService).sql index 754ad08233e..d689442c7fb 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed.LinqService).sql index 9b3a6059b2b..48930e6c953 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed.LinqService).sql index 47c46151094..4509d28f085 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed.LinqService).sql index 47c46151094..dd9220f0806 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed.LinqService).sql index 351474435f3..1d5f8935a56 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed.LinqService).sql index 6bf7b2c602e..316d88d3958 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed.LinqService).sql index efa300882d9..3769cdbb773 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed.LinqService).sql index 9c2b27f979a..eac49987077 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..4ebba231a3f --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,176 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..fcb7f91215e --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..8db081da17c --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed.LinqService).sql index 0868b4e5105..8db081da17c 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed.LinqService).sql index 3f5989ae893..76be946f80f 100644 --- a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..1c87985f878 --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..c8b86f923a4 --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..76be946f80f --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..5b19241a214 --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..0868b4e5105 --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.18.Managed.LinqService).sql new file mode 100644 index 00000000000..3f5989ae893 --- /dev/null +++ b/Oracle.18.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.18.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed.LinqService).sql index 1f7abf4a326..6a7161d8274 100644 --- a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed.LinqService).sql index 2bbe550089e..8c81aa10a4b 100644 --- a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed.LinqService).sql index edc89b06255..c7e72485eec 100644 --- a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed.LinqService).sql index 1f2131a200a..a39fe18cf53 100644 --- a/Oracle.18.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed.LinqService).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.18.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed.LinqService).sql index ea92ecf6ddf..2898fb72169 100644 --- a/Oracle.18.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed.LinqService).sql @@ -88,7 +88,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.18.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed.LinqService).sql b/Oracle.18.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed.LinqService).sql index 9886fc4e68c..589bbb5204c 100644 --- a/Oracle.18.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed.LinqService).sql +++ b/Oracle.18.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed.LinqService).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.18.Managed).sql index 90bf356edef..d58d74888ad 100644 --- a/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.18.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.18.Managed).sql index 90bf356edef..d58d74888ad 100644 --- a/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.18.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.18.Managed).sql index 61c7e742dab..2b623209ef3 100644 --- a/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.18.Managed).sql @@ -4,21 +4,21 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed).sql index 3893c462757..125c9ca4dfe 100644 --- a/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed).sql index f2febbd9b35..2f9ff7ea29a 100644 --- a/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.18.Managed).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed).sql index c37a00a7d54..bfcba882053 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.18.Managed).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed).sql index eac160904f9..7a30e245bc0 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.18.Managed).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed).sql index aa7e82d6698..fc8e3afd77a 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.18.Managed).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed).sql index 16aa094b645..c2ed2069996 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.18.Managed).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed).sql index 287140d88b8..3cc90bd8c65 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.18.Managed).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed).sql index a5e02fd6111..522f3904d46 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.18.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed).sql index 119b765ba97..67f3157c177 100644 --- a/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.18.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed,False).sql b/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed,False).sql index a7cb8586c8b..6580558b53b 100644 --- a/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed,False).sql +++ b/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.18.Managed,False).sql @@ -45,22 +45,24 @@ BeforeExecute -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.18.Managed Oracle.Managed Oracle12 diff --git a/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed).sql index e633fddb254..feb6b9d170e 100644 --- a/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.18.Managed).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed).sql index 18600f412ed..aff45adcf80 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed).sql index 28843e2203b..2cbec61a3cc 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed).sql index 28843e2203b..2cbec61a3cc 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,2).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,2).sql index 8a68cb61bb9..c3e76d758b4 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,2).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,3).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,3).sql index 505f7613581..9ebf6c2aec0 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,3).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,2).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,2).sql index 8a68cb61bb9..c3e76d758b4 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,2).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,3).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,3).sql index 505f7613581..9ebf6c2aec0 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,3).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.18.Managed,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,2).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,2).sql index 9906496f36d..89d132c5e77 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,2).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,3).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,3).sql index 2ca91107522..c387b6cf5cb 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,3).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,2).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,2).sql index 9906496f36d..89d132c5e77 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,2).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,3).sql b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,3).sql index 2ca91107522..c387b6cf5cb 100644 --- a/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,3).sql +++ b/Oracle.18.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.18.Managed,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.18.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed).sql index d5a63a3f80a..99e231a43b7 100644 --- a/Oracle.18.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.18.Managed).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,1).sql b/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,1).sql index 809002f14ba..ba68122e48b 100644 --- a/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,1).sql +++ b/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,2).sql b/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,2).sql index 34df6ce985f..fbc64ba61f9 100644 --- a/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,2).sql +++ b/Oracle.18.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.18.Managed,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.18.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed).sql index 3807ebc1c93..673588547fe 100644 --- a/Oracle.18.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.18.Managed).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,14).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,14).sql index 6c8246d060b..6e6acd5deba 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,14).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,15).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,15).sql index 4f9d8a025fb..ce4025a773d 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,15).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.18.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,14).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,14).sql index 16472bad9a6..101e5d32d2f 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,14).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,15).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,15).sql index ff759af2b5b..1f031aa72e3 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,15).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.18.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,14).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,14).sql index c7d1122cad2..790eab9ea06 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,14).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,15).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,15).sql index 76da0298916..60dd622def0 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,15).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.18.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,14).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,14).sql index 605db39b17a..ce3c4f2d5ef 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,14).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,15).sql b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,15).sql index 0f3efd74f18..2cbda76feca 100644 --- a/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,15).sql +++ b/Oracle.18.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.18.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed).sql index 4cb568ccb36..8f9026ded8c 100644 --- a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed).sql index 7f8037fa42e..57b0eabb320 100644 --- a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.18.Managed).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed).sql index b637d6de0bd..58f9094c5a5 100644 --- a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed).sql index 017e99a01e7..7910c704770 100644 --- a/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.18.Managed).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,False).sql b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,False).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,False).sql +++ b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,True).sql b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,True).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,True).sql +++ b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,False).sql b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,False).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,False).sql +++ b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,True).sql b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,True).sql index 0224aeb784d..947182820eb 100644 --- a/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,True).sql +++ b/Oracle.18.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.18.Managed,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed).sql index defc76e7d87..767281aefe6 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.18.Managed).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed).sql index 22a908cf2ca..d5fd6da8188 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.18.Managed).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed).sql index 6c853e234f3..671597f3c98 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.18.Managed).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed).sql index 6cb17ddb47c..f560a6c2913 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed).sql index c9faadccc6b..ef882b54aa0 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql index 8e4973867e3..5171c867f8d 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql index 9a2685fcc1d..80ac9141325 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql index f13bf3964a9..99e7ba4f4e1 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql index fccb91e4348..6e20a0766ba 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql index 59ca1a0e950..0567d85beea 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql index 10e4b3bccbf..d7b35ca1d68 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.18.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql index c78378aff8e..ddb2ec686ce 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.18.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql index 93a70e3c749..183ff938636 100644 --- a/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.18.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed).sql index 0c2491b945f..769c158cde2 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.18.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -107,13 +107,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed).sql index d88c9d39b2e..c0eb94f24f0 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.18.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed).sql index 9b3a6059b2b..48930e6c953 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.18.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed).sql index 47c46151094..4509d28f085 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.18.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed).sql index 47c46151094..dd9220f0806 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.18.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed).sql index 351474435f3..1d5f8935a56 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.18.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed).sql index 6bf7b2c602e..316d88d3958 100644 --- a/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.18.Managed).sql @@ -2,17 +2,21 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed).sql index efa300882d9..3769cdbb773 100644 --- a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed).sql index 9c2b27f979a..eac49987077 100644 --- a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.18.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.18.Managed).sql new file mode 100644 index 00000000000..fe2b43abf42 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.18.Managed).sql @@ -0,0 +1,82 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +INSERT ALL + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (1,10,NULL,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (2,NULL,20,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (3,NULL,NULL,30) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (4,NULL,NULL,NULL) +SELECT * FROM dual + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.18.Managed).sql index 9b7c4ee946a..55c5b6a4459 100644 --- a/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.18.Managed).sql @@ -2,38 +2,28 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p OUTER APPLY ( @@ -110,5 +110,5 @@ FROM ) t5 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.18.Managed).sql index a181a06fa0e..4de4f9d675a 100644 --- a/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.18.Managed).sql @@ -64,16 +64,16 @@ SELECT FROM ( SELECT - Nvl(t1."EnumNullable", t1."Enum") as "Converted1", + Coalesce(t1."EnumNullable", t1."Enum") as "Converted1", t1."Value1" as "Converted2" FROM "ValueConversion" t1 ) t2 UNION SELECT - Nvl(t1_1."EnumNullable", t1_1."Enum"), + Coalesce(t1_1."EnumNullable", t1_1."Enum"), t1_1."Value1", - Nvl(t1_1."EnumNullable", t1_1."Enum") + Coalesce(t1_1."EnumNullable", t1_1."Enum") FROM "ValueConversion" t1_1 diff --git a/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.18.Managed).sql index 98b5cbd5128..aa7f3acccad 100644 --- a/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.18.Managed).sql @@ -58,7 +58,7 @@ BeforeExecute -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - Nvl(t1."EnumNullable", t1."Enum") + Coalesce(t1."EnumNullable", t1."Enum") FROM "ValueConversion" t1 diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.18.Managed).sql new file mode 100644 index 00000000000..fcb7f91215e --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.18.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.18.Managed).sql new file mode 100644 index 00000000000..8db081da17c --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.18.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed).sql index 0868b4e5105..8db081da17c 100644 --- a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.18.Managed).sql @@ -2,17 +2,10 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed).sql index 3f5989ae893..76be946f80f 100644 --- a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.18.Managed).sql @@ -2,14 +2,10 @@ -- Oracle.18.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.18.Managed).sql new file mode 100644 index 00000000000..1c87985f878 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.18.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.18.Managed).sql new file mode 100644 index 00000000000..c8b86f923a4 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.18.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.18.Managed).sql new file mode 100644 index 00000000000..76be946f80f --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.18.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.18.Managed).sql new file mode 100644 index 00000000000..5b19241a214 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.18.Managed).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.18.Managed).sql new file mode 100644 index 00000000000..0868b4e5105 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.18.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.18.Managed).sql new file mode 100644 index 00000000000..3f5989ae893 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.18.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed).sql index 1f7abf4a326..6a7161d8274 100644 --- a/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.18.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed).sql index 2bbe550089e..8c81aa10a4b 100644 --- a/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.18.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed).sql index edc89b06255..c7e72485eec 100644 --- a/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.18.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.18.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed).sql index 1f2131a200a..a39fe18cf53 100644 --- a/Oracle.18.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.18.Managed).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.18.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed).sql index af4c9984644..349d9af7620 100644 --- a/Oracle.18.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.18.Managed).sql @@ -60,7 +60,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.18.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed).sql index 9886fc4e68c..589bbb5204c 100644 --- a/Oracle.18.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed).sql +++ b/Oracle.18.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.18.Managed).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed.LinqService).sql index 1b26ad67391..ed788d6a702 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed.LinqService).sql index edb8a1e04b6..eebbdfb7723 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed.LinqService).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed.LinqService).sql index 39a820cd107..d52a21dfd01 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed.LinqService).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed.LinqService).sql index 48fda8d2103..42a2e66cae8 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed.LinqService).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed.LinqService).sql index 56b98cd3f31..d2caed79d9a 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed.LinqService).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed.LinqService).sql index 6dd3599280e..74847582623 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed.LinqService).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed.LinqService).sql index 406257af05b..dee3f56a1aa 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed.LinqService).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed.LinqService).sql index 4be23d8dccb..9362f866aba 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed.LinqService).sql index 5074a136e33..92bbb1048c7 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed.LinqService,False).sql b/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed.LinqService,False).sql index e608b8ed138..86fbd66eddd 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed.LinqService,False).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed.LinqService,False).sql @@ -123,22 +123,24 @@ BeforeExecute -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.19.Managed Oracle.Managed Oracle12 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed.LinqService).sql index a502be4f2a6..e794210184d 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed.LinqService).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed.LinqService).sql index 4c9f0836031..40603b30839 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed.LinqService).sql index 53dcc9838b9..9f6f71d89f0 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed.LinqService).sql index 53dcc9838b9..9f6f71d89f0 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,2).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,2).sql index 0c4019b5783..fb4803dd41a 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,2).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,3).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,3).sql index 744da6bf06b..92f328113eb 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,3).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,2).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,2).sql index 0c4019b5783..fb4803dd41a 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,2).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,3).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,3).sql index 744da6bf06b..92f328113eb 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,3).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed.LinqService,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,2).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,2).sql index 3d40fc830d5..137c4ce0942 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,2).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,3).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,3).sql index 92577c8859f..86262aec748 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,3).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,2).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,2).sql index 3d40fc830d5..137c4ce0942 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,2).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,3).sql b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,3).sql index 92577c8859f..86262aec748 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,3).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed.LinqService,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed.LinqService).sql index 40c3c914167..a7aa6a6bfab 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,1).sql b/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,1).sql index e4f331e12ef..b7937ac7c10 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,1).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,2).sql b/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,2).sql index 082ef47ae7a..039a639bf28 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,2).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed.LinqService).sql index fd58518465e..0a6bc88dd22 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed.LinqService).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,14).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,14).sql index 3f4bb5c1b49..6cad8318b91 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,14).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,15).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,15).sql index a913fe8829b..08a302e801c 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,15).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,14).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,14).sql index d9d14ac9276..a4a527a59dd 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,14).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,15).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,15).sql index c9314cf6b01..e668be2c37b 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,15).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,14).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,14).sql index 3d54593c603..5a14c030161 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,14).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,15).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,15).sql index 61d4148206a..05879edee8c 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,15).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,14).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,14).sql index 57f67ce3ccc..33fd5b439e3 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,14).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,15).sql b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,15).sql index c0106f40242..650d6e1fc23 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,15).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed.LinqService).sql index e4c3e1a674c..5fe4ce1952f 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed.LinqService).sql index 747c94e3eb4..a4cfd159168 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed.LinqService).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed.LinqService).sql index 3162d69250b..d9c0cd44878 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed.LinqService).sql index 1f19019e8ec..7f7b2e528c5 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,False).sql b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,False).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,False).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,True).sql b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,True).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,True).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,False).sql b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,False).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,False).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,True).sql b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,True).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,True).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed.LinqService,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed.LinqService).sql index fc003921ab5..bd7c35e4c5b 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed.LinqService).sql index 18c2ced0ffe..dddeee1da15 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed.LinqService).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed.LinqService).sql index 01db0335067..92009dc18d5 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed.LinqService).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed.LinqService).sql index 2ceebd23e0d..f3e1f7b3a55 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed.LinqService).sql index 93493d809d1..b342c4c4745 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql index fbf98936e69..9d37af9d5ae 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql index 08f24c9a3b1..8f3946db6d2 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql index 057f5130473..bd26a3e0cb6 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql index dc10a94bdcd..4d403bef812 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql index 4a8c20d840b..6cac8c70db4 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql index f00573c2766..1b5cfca358e 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql index 03e58159869..66aef71d652 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql index 26c10caa5b5..a1f75f39301 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed.LinqService).sql index af9885cf775..fc133a7066a 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -551,13 +551,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed.LinqService).sql index cc64b0525b5..c407c160e10 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed.LinqService).sql index cc3af88f2e8..40ff2156c05 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed.LinqService).sql index 7aa7e5a5905..a41c2220374 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed.LinqService).sql index 7aa7e5a5905..892c9295e32 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed.LinqService).sql index 2c39a3312ee..284ad8c9003 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed.LinqService).sql index 814b4366b3f..381f391888d 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed.LinqService).sql index 7c4add88d11..662e9324686 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed.LinqService).sql index 8c250c3d913..b14bddbea6c 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..7852f2652cd --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,176 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..7144c965253 --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..cde81920703 --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed.LinqService).sql index ac1bc0123d2..cde81920703 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed.LinqService).sql index 2cddd54df79..8f0a32f451b 100644 --- a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..eaebb1d1b6c --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..cd2eec2a02c --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..8f0a32f451b --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..e19e4e47657 --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..ac1bc0123d2 --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.19.Managed.LinqService).sql new file mode 100644 index 00000000000..2cddd54df79 --- /dev/null +++ b/Oracle.19.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.19.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed.LinqService).sql index da92a43aa3c..70eb7f1b83f 100644 --- a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed.LinqService).sql index 27067dc8a93..2e6beab5727 100644 --- a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed.LinqService).sql index 3e55d73e30c..99a0f816703 100644 --- a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed.LinqService).sql index a662ce456c1..c1c368b870f 100644 --- a/Oracle.19.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed.LinqService).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.19.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed.LinqService).sql index a3a896e433f..d58aa924447 100644 --- a/Oracle.19.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed.LinqService).sql @@ -88,7 +88,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.19.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed.LinqService).sql b/Oracle.19.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed.LinqService).sql index 15e58269a3a..4d92d5e74f8 100644 --- a/Oracle.19.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed.LinqService).sql +++ b/Oracle.19.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed.LinqService).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.19.Managed).sql index 38c5716df86..c2177baa9da 100644 --- a/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.19.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.19.Managed).sql index 38c5716df86..c2177baa9da 100644 --- a/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.19.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.19.Managed).sql index ad543810101..7ed4d80ffe1 100644 --- a/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.19.Managed).sql @@ -4,21 +4,21 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed).sql index 1b26ad67391..ed788d6a702 100644 --- a/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed).sql index edb8a1e04b6..eebbdfb7723 100644 --- a/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.19.Managed).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed).sql index 39a820cd107..d52a21dfd01 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.19.Managed).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed).sql index 48fda8d2103..42a2e66cae8 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.19.Managed).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed).sql index 56b98cd3f31..d2caed79d9a 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.19.Managed).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed).sql index 6dd3599280e..74847582623 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.19.Managed).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed).sql index 406257af05b..dee3f56a1aa 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.19.Managed).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed).sql index 4be23d8dccb..9362f866aba 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.19.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed).sql index 5074a136e33..92bbb1048c7 100644 --- a/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.19.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed,False).sql b/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed,False).sql index 4221dc6959c..0a931236dd4 100644 --- a/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed,False).sql +++ b/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.19.Managed,False).sql @@ -45,22 +45,24 @@ BeforeExecute -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.19.Managed Oracle.Managed Oracle12 diff --git a/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed).sql index a502be4f2a6..e794210184d 100644 --- a/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.19.Managed).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed).sql index 4c9f0836031..40603b30839 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed).sql index 53dcc9838b9..9f6f71d89f0 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed).sql index 53dcc9838b9..9f6f71d89f0 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,2).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,2).sql index 0c4019b5783..fb4803dd41a 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,2).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,3).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,3).sql index 744da6bf06b..92f328113eb 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,3).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,2).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,2).sql index 0c4019b5783..fb4803dd41a 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,2).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,3).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,3).sql index 744da6bf06b..92f328113eb 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,3).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.19.Managed,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,2).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,2).sql index 3d40fc830d5..137c4ce0942 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,2).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,3).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,3).sql index 92577c8859f..86262aec748 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,3).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,2).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,2).sql index 3d40fc830d5..137c4ce0942 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,2).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,3).sql b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,3).sql index 92577c8859f..86262aec748 100644 --- a/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,3).sql +++ b/Oracle.19.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.19.Managed,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.19.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed).sql index 40c3c914167..a7aa6a6bfab 100644 --- a/Oracle.19.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.19.Managed).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,1).sql b/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,1).sql index e4f331e12ef..b7937ac7c10 100644 --- a/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,1).sql +++ b/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,2).sql b/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,2).sql index 082ef47ae7a..039a639bf28 100644 --- a/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,2).sql +++ b/Oracle.19.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.19.Managed,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.19.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed).sql index fd58518465e..0a6bc88dd22 100644 --- a/Oracle.19.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.19.Managed).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,14).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,14).sql index 8cc69c81ac5..e5da267657f 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,14).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,15).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,15).sql index 157d0dcb5fe..5e19e88e455 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,15).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.19.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,14).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,14).sql index 854d5e5c37a..43d8b989afe 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,14).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,15).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,15).sql index 33de65368c2..90e7a0b63fb 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,15).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.19.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,14).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,14).sql index 1e9e65c1193..9e34b025feb 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,14).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,15).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,15).sql index 94bd9725a21..94c1ad39929 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,15).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.19.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,14).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,14).sql index 247a821532e..1fb0f97977a 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,14).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,15).sql b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,15).sql index 657407a4546..eea31b410a6 100644 --- a/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,15).sql +++ b/Oracle.19.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.19.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed).sql index e4c3e1a674c..5fe4ce1952f 100644 --- a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed).sql index 747c94e3eb4..a4cfd159168 100644 --- a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.19.Managed).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed).sql index 3162d69250b..d9c0cd44878 100644 --- a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed).sql index 1f19019e8ec..7f7b2e528c5 100644 --- a/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.19.Managed).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,False).sql b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,False).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,False).sql +++ b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,True).sql b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,True).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,True).sql +++ b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,False).sql b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,False).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,False).sql +++ b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,True).sql b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,True).sql index 7460544243e..697d0733e8f 100644 --- a/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,True).sql +++ b/Oracle.19.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.19.Managed,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed).sql index fc003921ab5..bd7c35e4c5b 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.19.Managed).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed).sql index 18c2ced0ffe..dddeee1da15 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.19.Managed).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed).sql index 01db0335067..92009dc18d5 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.19.Managed).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed).sql index 2ceebd23e0d..f3e1f7b3a55 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed).sql index 93493d809d1..b342c4c4745 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql index fbf98936e69..9d37af9d5ae 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql index 08f24c9a3b1..8f3946db6d2 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql index 057f5130473..bd26a3e0cb6 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql index dc10a94bdcd..4d403bef812 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql index 4a8c20d840b..6cac8c70db4 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql index f00573c2766..1b5cfca358e 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.19.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql index 03e58159869..66aef71d652 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.19.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql index 26c10caa5b5..a1f75f39301 100644 --- a/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.19.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed).sql index 44a6d042e3d..8f2e8c9129e 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.19.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -107,13 +107,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed).sql index ef140663923..6e488742193 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.19.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed).sql index cc3af88f2e8..40ff2156c05 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.19.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed).sql index 7aa7e5a5905..a41c2220374 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.19.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed).sql index 7aa7e5a5905..892c9295e32 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.19.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed).sql index 2c39a3312ee..284ad8c9003 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.19.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed).sql index 814b4366b3f..381f391888d 100644 --- a/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.19.Managed).sql @@ -2,17 +2,21 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed).sql index 7c4add88d11..662e9324686 100644 --- a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed).sql index 8c250c3d913..b14bddbea6c 100644 --- a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.19.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.19.Managed).sql new file mode 100644 index 00000000000..ed68c441edc --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.19.Managed).sql @@ -0,0 +1,82 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +INSERT ALL + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (1,10,NULL,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (2,NULL,20,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (3,NULL,NULL,30) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (4,NULL,NULL,NULL) +SELECT * FROM dual + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.19.Managed).sql index 28763a5d1d1..b9d2cf092b6 100644 --- a/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.19.Managed).sql @@ -2,38 +2,28 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p OUTER APPLY ( @@ -110,5 +110,5 @@ FROM ) t5 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.19.Managed).sql index 7db1d83ed7c..83096a106c9 100644 --- a/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.19.Managed).sql @@ -64,16 +64,16 @@ SELECT FROM ( SELECT - Nvl(t1."EnumNullable", t1."Enum") as "Converted1", + Coalesce(t1."EnumNullable", t1."Enum") as "Converted1", t1."Value1" as "Converted2" FROM "ValueConversion" t1 ) t2 UNION SELECT - Nvl(t1_1."EnumNullable", t1_1."Enum"), + Coalesce(t1_1."EnumNullable", t1_1."Enum"), t1_1."Value1", - Nvl(t1_1."EnumNullable", t1_1."Enum") + Coalesce(t1_1."EnumNullable", t1_1."Enum") FROM "ValueConversion" t1_1 diff --git a/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.19.Managed).sql index 566190c2984..0139a5a3815 100644 --- a/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.19.Managed).sql @@ -58,7 +58,7 @@ BeforeExecute -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - Nvl(t1."EnumNullable", t1."Enum") + Coalesce(t1."EnumNullable", t1."Enum") FROM "ValueConversion" t1 diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.19.Managed).sql new file mode 100644 index 00000000000..7144c965253 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.19.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.19.Managed).sql new file mode 100644 index 00000000000..cde81920703 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.19.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed).sql index ac1bc0123d2..cde81920703 100644 --- a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.19.Managed).sql @@ -2,17 +2,10 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed).sql index 2cddd54df79..8f0a32f451b 100644 --- a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.19.Managed).sql @@ -2,14 +2,10 @@ -- Oracle.19.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.19.Managed).sql new file mode 100644 index 00000000000..eaebb1d1b6c --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.19.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.19.Managed).sql new file mode 100644 index 00000000000..cd2eec2a02c --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.19.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.19.Managed).sql new file mode 100644 index 00000000000..8f0a32f451b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.19.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.19.Managed).sql new file mode 100644 index 00000000000..e19e4e47657 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.19.Managed).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.19.Managed).sql new file mode 100644 index 00000000000..ac1bc0123d2 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.19.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.19.Managed).sql new file mode 100644 index 00000000000..2cddd54df79 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.19.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed).sql index da92a43aa3c..70eb7f1b83f 100644 --- a/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.19.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed).sql index 27067dc8a93..2e6beab5727 100644 --- a/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.19.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed).sql index 3e55d73e30c..99a0f816703 100644 --- a/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.19.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.19.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed).sql index a662ce456c1..c1c368b870f 100644 --- a/Oracle.19.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.19.Managed).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.19.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed).sql index 4c16dfa009c..744e5331a14 100644 --- a/Oracle.19.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.19.Managed).sql @@ -60,7 +60,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.19.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed).sql index 15e58269a3a..4d92d5e74f8 100644 --- a/Oracle.19.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed).sql +++ b/Oracle.19.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.19.Managed).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed.LinqService).sql index ed4f4b5ad13..1f40ec07db7 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed.LinqService).sql index a1507fd0b61..c9fab644cb5 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed.LinqService).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed.LinqService).sql index 769a70d87e8..bbef9833b01 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed.LinqService).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed.LinqService).sql index 68d6448845e..ca095d358e0 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed.LinqService).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed.LinqService).sql index 2bc2f0a3b16..346cac87b55 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed.LinqService).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed.LinqService).sql index 817db7e2951..851a88bca8b 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed.LinqService).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed.LinqService).sql index 176ad1a6cdd..fcbfecda697 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed.LinqService).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed.LinqService).sql index a2c518edee6..7cc4b78ee43 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed.LinqService).sql index f39df70b2cb..9c0270f89b4 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed.LinqService,False).sql b/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed.LinqService,False).sql index fd3b83a117f..b886420c234 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed.LinqService,False).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed.LinqService,False).sql @@ -123,22 +123,24 @@ BeforeExecute -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.21.Managed Oracle.Managed Oracle12 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed.LinqService).sql index e9dd7a6e727..0fd63c8ce48 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed.LinqService).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed.LinqService).sql index cce59e51bbc..0a4081bb8b7 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed.LinqService).sql index 6bb91915b65..874651c5d55 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed.LinqService).sql index 6bb91915b65..874651c5d55 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,2).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,2).sql index df8e384c70a..7f6f4a51c2c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,2).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,3).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,3).sql index 6a7951d1586..6f0a2b37b63 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,3).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,2).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,2).sql index df8e384c70a..7f6f4a51c2c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,2).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,3).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,3).sql index 6a7951d1586..6f0a2b37b63 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,3).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed.LinqService,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,2).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,2).sql index bd281acdb4f..87470d39b95 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,2).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,3).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,3).sql index ea5afcaad24..54b69e36607 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,3).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,2).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,2).sql index bd281acdb4f..87470d39b95 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,2).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,3).sql b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,3).sql index ea5afcaad24..54b69e36607 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,3).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed.LinqService,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed.LinqService).sql index 990ee494b6d..90547140098 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,1).sql b/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,1).sql index 2338675032e..f9f81af1452 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,1).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,2).sql b/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,2).sql index e4992c9740d..62523832895 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,2).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed.LinqService).sql index 57132ea1323..98388a84c75 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed.LinqService).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,14).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,14).sql index 6593cd00c88..a82f1c5e2eb 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,14).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,15).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,15).sql index bf18eb25adb..91549151d06 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,15).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,14).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,14).sql index 8d9424dae76..532f48143ce 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,14).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,15).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,15).sql index 9ab3d0cf930..2f9a4e073ff 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,15).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,14).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,14).sql index 07432657108..09d64092006 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,14).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,15).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,15).sql index 28eb27c6f58..047df060275 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,15).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,14).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,14).sql index 60f403310ae..8a4ffd3d4ea 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,14).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,15).sql b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,15).sql index 07192797aa9..daa41ef64e8 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,15).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed.LinqService).sql index a2580634d19..aea7439195d 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed.LinqService).sql index 7fb73bffe41..11d5d688390 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed.LinqService).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed.LinqService).sql index 72d755188d3..7f87d01263c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed.LinqService).sql index 66a1c83e66b..efd2ee49d2b 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,False).sql b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,False).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,False).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,True).sql b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,True).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,True).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,False).sql b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,False).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,False).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,True).sql b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,True).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,True).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed.LinqService,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed.LinqService).sql index 6ffc26329d5..e132b9285e2 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed.LinqService).sql index 763e65835ec..3ef80fd49d8 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed.LinqService).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed.LinqService).sql index 65678d4a65b..26409b68283 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed.LinqService).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed.LinqService).sql index 1b60fdcc179..498df00de56 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed.LinqService).sql index 1853fb4f8c1..f733d00fcc3 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql index 4b298997d6a..b1bbeaa2057 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql index 7c9fe414dfc..ccab5e0f59f 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql index e3c4b9ad791..b2540e0be34 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql index e2fce528801..cc754c6b90e 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql index 03fd6cb8841..64c4caaeb97 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql index 93d67bba216..219bd1da11a 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql index 3c85e990cbf..2c63fc75524 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql index 1077489a9a8..e3c55cb34be 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed.LinqService).sql index afd7c063137..42f58c413ae 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -551,13 +551,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed.LinqService).sql index 04fad3a611b..c498c0381b6 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed.LinqService).sql index f442b057afa..2d7b9120ba6 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed.LinqService).sql index 7b81a0fb8e1..23447cacf7d 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed.LinqService).sql index 7b81a0fb8e1..d807e1131ba 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed.LinqService).sql index 10dd2a9b9d0..45a941b7c85 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed.LinqService).sql index 16bd0b8876d..8f5f47b079c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed.LinqService).sql index 5236e53c19d..f166c2a6f7c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed.LinqService).sql index 701039d078d..2f513dd122f 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..4de22cc51dc --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,176 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..8f7dee775cd --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..6a456fc3c3c --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed.LinqService).sql index 27f4173278c..6a456fc3c3c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed.LinqService).sql index f1d552aec8b..fbd420b681c 100644 --- a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..a18fdd66f79 --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..748b952fc84 --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..fbd420b681c --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..80de157fb6c --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..27f4173278c --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.21.Managed.LinqService).sql new file mode 100644 index 00000000000..f1d552aec8b --- /dev/null +++ b/Oracle.21.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.21.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed.LinqService).sql index 7b12dadffcd..0d27a7c34d6 100644 --- a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed.LinqService).sql index abfe2044639..9b5e4f90663 100644 --- a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed.LinqService).sql index 55e27b3cfbd..7e283c3a276 100644 --- a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed.LinqService).sql index 574061ab8e3..8592e3fafc2 100644 --- a/Oracle.21.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed.LinqService).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.21.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed.LinqService).sql index 655407b0cb1..01e3f986559 100644 --- a/Oracle.21.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed.LinqService).sql @@ -88,7 +88,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.21.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed.LinqService).sql b/Oracle.21.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed.LinqService).sql index 49821e7d41b..158aac31958 100644 --- a/Oracle.21.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed.LinqService).sql +++ b/Oracle.21.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed.LinqService).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.21.Managed).sql index 52d7b7fda9e..8cc057f54fe 100644 --- a/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.21.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.21.Managed).sql index 52d7b7fda9e..8cc057f54fe 100644 --- a/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.21.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.21.Managed).sql index a9b6c7cafac..cdbdaac6f81 100644 --- a/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.21.Managed).sql @@ -4,21 +4,21 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed).sql index ed4f4b5ad13..1f40ec07db7 100644 --- a/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed).sql index a1507fd0b61..c9fab644cb5 100644 --- a/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.21.Managed).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed).sql index 769a70d87e8..bbef9833b01 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.21.Managed).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed).sql index 68d6448845e..ca095d358e0 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.21.Managed).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed).sql index 2bc2f0a3b16..346cac87b55 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.21.Managed).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed).sql index 817db7e2951..851a88bca8b 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.21.Managed).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed).sql index 176ad1a6cdd..fcbfecda697 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.21.Managed).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed).sql index a2c518edee6..7cc4b78ee43 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.21.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed).sql index f39df70b2cb..9c0270f89b4 100644 --- a/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.21.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed,False).sql b/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed,False).sql index c19382d5c52..3934e705779 100644 --- a/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed,False).sql +++ b/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.21.Managed,False).sql @@ -45,22 +45,24 @@ BeforeExecute -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.21.Managed Oracle.Managed Oracle12 diff --git a/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed).sql index e9dd7a6e727..0fd63c8ce48 100644 --- a/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.21.Managed).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed).sql index cce59e51bbc..0a4081bb8b7 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed).sql index 6bb91915b65..874651c5d55 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed).sql index 6bb91915b65..874651c5d55 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,2).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,2).sql index df8e384c70a..7f6f4a51c2c 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,2).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,3).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,3).sql index 6a7951d1586..6f0a2b37b63 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,3).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,2).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,2).sql index df8e384c70a..7f6f4a51c2c 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,2).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,3).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,3).sql index 6a7951d1586..6f0a2b37b63 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,3).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.21.Managed,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,2).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,2).sql index bd281acdb4f..87470d39b95 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,2).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,3).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,3).sql index ea5afcaad24..54b69e36607 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,3).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,2).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,2).sql index bd281acdb4f..87470d39b95 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,2).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,3).sql b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,3).sql index ea5afcaad24..54b69e36607 100644 --- a/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,3).sql +++ b/Oracle.21.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.21.Managed,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.21.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed).sql index 990ee494b6d..90547140098 100644 --- a/Oracle.21.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.21.Managed).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,1).sql b/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,1).sql index 2338675032e..f9f81af1452 100644 --- a/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,1).sql +++ b/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,2).sql b/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,2).sql index e4992c9740d..62523832895 100644 --- a/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,2).sql +++ b/Oracle.21.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.21.Managed,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.21.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed).sql index 57132ea1323..98388a84c75 100644 --- a/Oracle.21.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.21.Managed).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,14).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,14).sql index 51716adb517..05b3f6f2e8c 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,14).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,15).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,15).sql index 7511d676aba..85b048e4c9e 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,15).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.21.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,14).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,14).sql index 624036ae7bc..f44adcb8706 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,14).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,15).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,15).sql index 505c5cb528a..aa50b7121fb 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,15).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.21.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,14).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,14).sql index bc58ce371ce..535112a545c 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,14).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,15).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,15).sql index 36447c56f82..6a090ef868a 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,15).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.21.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,14).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,14).sql index 4285f9b6e6b..f3b2692df0b 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,14).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,15).sql b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,15).sql index 48cb070e373..f4313cb35bc 100644 --- a/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,15).sql +++ b/Oracle.21.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.21.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed).sql index a2580634d19..aea7439195d 100644 --- a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed).sql index 7fb73bffe41..11d5d688390 100644 --- a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.21.Managed).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed).sql index 72d755188d3..7f87d01263c 100644 --- a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed).sql index 66a1c83e66b..efd2ee49d2b 100644 --- a/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.21.Managed).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,False).sql b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,False).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,False).sql +++ b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,True).sql b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,True).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,True).sql +++ b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,False).sql b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,False).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,False).sql +++ b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,True).sql b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,True).sql index 1786fb89a96..9958c62ff40 100644 --- a/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,True).sql +++ b/Oracle.21.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.21.Managed,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed).sql index 6ffc26329d5..e132b9285e2 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.21.Managed).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed).sql index 763e65835ec..3ef80fd49d8 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.21.Managed).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed).sql index 65678d4a65b..26409b68283 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.21.Managed).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed).sql index 1b60fdcc179..498df00de56 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed).sql index 1853fb4f8c1..f733d00fcc3 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql index 4b298997d6a..b1bbeaa2057 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql index 7c9fe414dfc..ccab5e0f59f 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql index e3c4b9ad791..b2540e0be34 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql index e2fce528801..cc754c6b90e 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql index 03fd6cb8841..64c4caaeb97 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql index 93d67bba216..219bd1da11a 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.21.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql index 3c85e990cbf..2c63fc75524 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.21.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql index 1077489a9a8..e3c55cb34be 100644 --- a/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.21.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed).sql index d954d2daf08..3dc2276a92b 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.21.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -107,13 +107,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed).sql index 07a9eba9d22..7456bda437d 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.21.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed).sql index f442b057afa..2d7b9120ba6 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.21.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed).sql index 7b81a0fb8e1..23447cacf7d 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.21.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed).sql index 7b81a0fb8e1..d807e1131ba 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.21.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed).sql index 10dd2a9b9d0..45a941b7c85 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.21.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed).sql index 16bd0b8876d..8f5f47b079c 100644 --- a/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.21.Managed).sql @@ -2,17 +2,21 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed).sql index 5236e53c19d..f166c2a6f7c 100644 --- a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed).sql index 701039d078d..2f513dd122f 100644 --- a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.21.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.21.Managed).sql new file mode 100644 index 00000000000..2f08866b7c0 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.21.Managed).sql @@ -0,0 +1,82 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +INSERT ALL + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (1,10,NULL,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (2,NULL,20,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (3,NULL,NULL,30) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (4,NULL,NULL,NULL) +SELECT * FROM dual + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.21.Managed).sql index 0d0ffe20ae3..4e6ee6bf783 100644 --- a/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.21.Managed).sql @@ -2,38 +2,28 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p OUTER APPLY ( @@ -110,5 +110,5 @@ FROM ) t5 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.21.Managed).sql index e442fa408de..f9d71161228 100644 --- a/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.21.Managed).sql @@ -64,16 +64,16 @@ SELECT FROM ( SELECT - Nvl(t1."EnumNullable", t1."Enum") as "Converted1", + Coalesce(t1."EnumNullable", t1."Enum") as "Converted1", t1."Value1" as "Converted2" FROM "ValueConversion" t1 ) t2 UNION SELECT - Nvl(t1_1."EnumNullable", t1_1."Enum"), + Coalesce(t1_1."EnumNullable", t1_1."Enum"), t1_1."Value1", - Nvl(t1_1."EnumNullable", t1_1."Enum") + Coalesce(t1_1."EnumNullable", t1_1."Enum") FROM "ValueConversion" t1_1 diff --git a/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.21.Managed).sql index ae9b8313e35..db368c74f89 100644 --- a/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.21.Managed).sql @@ -58,7 +58,7 @@ BeforeExecute -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - Nvl(t1."EnumNullable", t1."Enum") + Coalesce(t1."EnumNullable", t1."Enum") FROM "ValueConversion" t1 diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.21.Managed).sql new file mode 100644 index 00000000000..8f7dee775cd --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.21.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.21.Managed).sql new file mode 100644 index 00000000000..6a456fc3c3c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.21.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed).sql index 27f4173278c..6a456fc3c3c 100644 --- a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.21.Managed).sql @@ -2,17 +2,10 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed).sql index f1d552aec8b..fbd420b681c 100644 --- a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.21.Managed).sql @@ -2,14 +2,10 @@ -- Oracle.21.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.21.Managed).sql new file mode 100644 index 00000000000..a18fdd66f79 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.21.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.21.Managed).sql new file mode 100644 index 00000000000..748b952fc84 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.21.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.21.Managed).sql new file mode 100644 index 00000000000..fbd420b681c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.21.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.21.Managed).sql new file mode 100644 index 00000000000..80de157fb6c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.21.Managed).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.21.Managed).sql new file mode 100644 index 00000000000..27f4173278c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.21.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.21.Managed).sql new file mode 100644 index 00000000000..f1d552aec8b --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.21.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed).sql index 7b12dadffcd..0d27a7c34d6 100644 --- a/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.21.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed).sql index abfe2044639..9b5e4f90663 100644 --- a/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.21.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed).sql index 55e27b3cfbd..7e283c3a276 100644 --- a/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.21.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.21.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed).sql index 574061ab8e3..8592e3fafc2 100644 --- a/Oracle.21.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.21.Managed).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.21.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed).sql index 986ee31f5ea..1131a6b5d03 100644 --- a/Oracle.21.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.21.Managed).sql @@ -60,7 +60,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.21.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed).sql index 49821e7d41b..158aac31958 100644 --- a/Oracle.21.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed).sql +++ b/Oracle.21.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.21.Managed).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed.LinqService).sql index 1cb1a993963..b1fdc1ce0cd 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed.LinqService).sql index 3d80b340ab9..4e77b252c4e 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed.LinqService).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed.LinqService).sql index f432ff419d7..8c8c8080ffc 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed.LinqService).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed.LinqService).sql index 35afa1a4397..e8526e2ecc4 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed.LinqService).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed.LinqService).sql index 6a3afe24a2f..3af9894f50a 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed.LinqService).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed.LinqService).sql index 730bc5a05c3..1d22caca9e0 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed.LinqService).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed.LinqService).sql index bc4584fdc3b..a75803d0acc 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed.LinqService).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed.LinqService).sql index af023cf40f6..731ddfd9cbb 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed.LinqService).sql index 8c4c8e3ea44..68d5256f93d 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed.LinqService).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed.LinqService,False).sql b/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed.LinqService,False).sql index ef0cee119b2..dd3054676b5 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed.LinqService,False).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed.LinqService,False).sql @@ -123,22 +123,24 @@ BeforeExecute -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.23.Managed Oracle.Managed Oracle12 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed.LinqService).sql index 6c78c1a7f91..21f806be602 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed.LinqService).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed.LinqService).sql index cd6563716e7..0b3dae8a1a1 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed.LinqService).sql index ed841a025f6..7c7eab52dbf 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed.LinqService).sql index ed841a025f6..7c7eab52dbf 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,2).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,2).sql index bae4b253859..3363274dbf1 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,2).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,3).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,3).sql index d08e1bbd8a2..ca1bd087f36 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,3).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,2).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,2).sql index bae4b253859..3363274dbf1 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,2).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,3).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,3).sql index d08e1bbd8a2..ca1bd087f36 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,3).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed.LinqService,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,2).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,2).sql index ec068bf34db..3b1fc4fc096 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,2).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,3).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,3).sql index e3b82aebcc0..0da14e0f7f5 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,3).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,2).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,2).sql index ec068bf34db..3b1fc4fc096 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,2).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,3).sql b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,3).sql index e3b82aebcc0..0da14e0f7f5 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,3).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed.LinqService,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed.LinqService).sql index 98efa34dd6f..3a6cac6a6e0 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,1).sql b/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,1).sql index 585ad67f9a0..0fa24faf66d 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,1).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,2).sql b/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,2).sql index 281efc55718..0946272c5a0 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,2).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed.LinqService).sql index 301d1255e96..fb54e10b560 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed.LinqService).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,14).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,14).sql index 5b4a72b216f..31328bc7954 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,14).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,15).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,15).sql index ed096e4f22f..d80d97983a4 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,15).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,14).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,14).sql index 0667e8e5b1e..e31c909981b 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,14).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,15).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,15).sql index 01b888fd3c9..604d6a363eb 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,15).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,14).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,14).sql index 333a220a031..6acdcfa8e5d 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,14).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,15).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,15).sql index 9fb4f98fe51..41b130e6110 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,15).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,14).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,14).sql index 06ba655cb9e..e95234fbcdf 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,14).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,14).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,15).sql b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,15).sql index 755601acbe1..0584dabf98d 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,15).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed.LinqService,15).sql @@ -399,10 +399,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed.LinqService).sql index 355b0bad8f2..3e052bfb291 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed.LinqService).sql index ccbd4055a3f..f4d0d6a8aaf 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed.LinqService).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed.LinqService).sql index 1c22fabd4d1..67e9295ae53 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed.LinqService).sql index 3c9150f33d0..d1a6d5d8e8f 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,False).sql b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,False).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,False).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,True).sql b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,True).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,True).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,False).sql b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,False).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,False).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,True).sql b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,True).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,True).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed.LinqService,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed.LinqService).sql index 52f6de06162..7ce17cfd527 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed.LinqService).sql index f1151be8a02..fd90728323b 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed.LinqService).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed.LinqService).sql index 80c5bd43b06..216ee556bbf 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed.LinqService).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed.LinqService).sql index ea9e010e1b8..a6e88412acf 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed.LinqService).sql index fa86e27d3e4..c9d1ed0acea 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql index 9f1da9e986a..8e19748c33e 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql index 4fac63ca0aa..be88a7d7a98 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql index 27430b4d97c..0a7cf431eb5 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql index 92608d79a4c..ff39521fe30 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql index 8928aeb6c69..d5d663a3ade 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql index d9679041624..0aa1ba5f5db 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql index affc383de6a..0963e707b17 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql index 5e3fdebf628..a461d828221 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed.LinqService).sql index 305a3f9e15a..e7863e6bad2 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -551,13 +551,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed.LinqService).sql index cb193bdad1c..27925f497a5 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed.LinqService).sql @@ -521,13 +521,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed.LinqService).sql index ef33ef465b0..ca510bffb9e 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed.LinqService).sql index d4fd2a3d787..e728abd9494 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed.LinqService).sql index d4fd2a3d787..189f202aafb 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed.LinqService).sql index a98ed95d10b..b8162d6401e 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed.LinqService).sql index 89c81bd4201..cfecd9aefd9 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed.LinqService).sql index 0a0e8649145..891cef13828 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed.LinqService).sql index e66682c55a1..23d92d375d8 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed.LinqService).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..2c043c7b839 --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,176 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 1 +DECLARE @Nullable1 Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 2 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 3 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 +DECLARE @Id Int32 +SET @Id = 4 +DECLARE @Nullable1 Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..88fa992127c --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..0637a756352 --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed.LinqService).sql index c71df95bb54..0637a756352 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed.LinqService).sql index 9d32afe5486..a6e1205bb6c 100644 --- a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..8608943cd62 --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..9c01b08825f --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..a6e1205bb6c --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..303d54a3514 --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..c71df95bb54 --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.23.Managed.LinqService).sql new file mode 100644 index 00000000000..9d32afe5486 --- /dev/null +++ b/Oracle.23.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.23.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed.LinqService).sql index f543194b34c..24d3de9cbc3 100644 --- a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed.LinqService).sql index f8ea6e4c5ce..81789b00130 100644 --- a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed.LinqService).sql index 8edaa61242a..71626c5762d 100644 --- a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed.LinqService).sql index 2c14a6149a2..36211a90b5c 100644 --- a/Oracle.23.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed.LinqService).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.23.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed.LinqService).sql index 4449e8251ae..1ecd46ab4a6 100644 --- a/Oracle.23.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed.LinqService).sql @@ -88,7 +88,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.23.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed.LinqService).sql b/Oracle.23.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed.LinqService).sql index bbb5c5fe70d..2ef66644319 100644 --- a/Oracle.23.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed.LinqService).sql +++ b/Oracle.23.Managed.LinqService/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed.LinqService).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.23.Managed).sql index b4ae322393d..b65035342e8 100644 --- a/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(Oracle.23.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.23.Managed).sql index b4ae322393d..b65035342e8 100644 --- a/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(Oracle.23.Managed).sql @@ -4,22 +4,22 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.23.Managed).sql index c38d1851cfd..43637bfce63 100644 --- a/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(Oracle.23.Managed).sql @@ -4,21 +4,21 @@ DECLARE @take Int32 SET @take = 100 SELECT - g_2."ParentID", - g_2.COUNT_1, - g_2."c1" + t1."key_1", + t1.COUNT_1, + t1."window_1" FROM ( SELECT - g_1."ParentID", + g_1."ParentID" as "key_1", COUNT(*) as COUNT_1, - COUNT(*) OVER() as "c1" + COUNT(*) OVER() as "window_1" FROM "Child" g_1 GROUP BY g_1."ParentID" - ) g_2 + ) t1 ORDER BY - g_2."ParentID" DESC + t1."key_1" DESC FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed).sql index 1cb1a993963..b1fdc1ce0cd 100644 --- a/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.ExprCoalesce(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(p."Value1", 100) + 50 + Coalesce(p."Value1", 100) + 50 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed).sql index 3d80b340ab9..4e77b252c4e 100644 --- a/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/CommonTests/Tests.Linq.CommonTests.GroupByUnion1(Oracle.23.Managed).sql @@ -15,8 +15,8 @@ FROM gr."ParentID" < 4 UNION ALL SELECT - Nvl(g_1."ParentID", 0) as "ParentID", - Nvl(g_1."GrandChildID", 0) as ID + Coalesce(g_1."ParentID", 0) as "ParentID", + Coalesce(g_1."GrandChildID", 0) as ID FROM "GrandChild" g_1 WHERE diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed).sql index f432ff419d7..8c8c8080ffc 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat83(Oracle.23.Managed).sql @@ -4,7 +4,7 @@ SELECT c_1."ParentID", c_1."ParentID", - Nvl(c_1."Value1", 0) + Coalesce(c_1."Value1", 0) FROM "Parent" c_1 UNION ALL diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed).sql index 35afa1a4397..e8526e2ecc4 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat84(Oracle.23.Managed).sql @@ -11,7 +11,7 @@ UNION ALL SELECT c_2."ParentID", c_2."ParentID", - Nvl(c_2."Value1", 0) + Coalesce(c_2."Value1", 0) FROM "Parent" c_2 diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed).sql index 6a3afe24a2f..3af9894f50a 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat85(Oracle.23.Managed).sql @@ -3,7 +3,7 @@ SELECT c_1."ParentID", - Nvl(c_1."Value1", 0), + Coalesce(c_1."Value1", 0), c_1."ParentID" FROM "Parent" c_1 diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed).sql index 730bc5a05c3..1d22caca9e0 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Concat86(Oracle.23.Managed).sql @@ -10,7 +10,7 @@ FROM UNION ALL SELECT c_2."ParentID", - Nvl(c_2."Value1", 0), + Coalesce(c_2."Value1", 0), c_2."ParentID" FROM "Parent" c_2 diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed).sql index bc4584fdc3b..a75803d0acc 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.ConcatWithDifferentProjections(Oracle.23.Managed).sql @@ -9,7 +9,7 @@ FROM "Parent" p1 UNION ALL SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL FROM diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed).sql index af023cf40f6..731ddfd9cbb 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union54(Oracle.23.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p1 UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed).sql index 8c4c8e3ea44..68d5256f93d 100644 --- a/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ConcatUnionTests/Tests.Linq.ConcatUnionTests.Union541(Oracle.23.Managed).sql @@ -12,7 +12,7 @@ FROM "Parent" p UNION SELECT - Nvl(p2."Value1", 0), + Coalesce(p2."Value1", 0), NULL, NULL, t1."ParentID", diff --git a/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed,False).sql b/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed,False).sql index 51628c42c50..7b26de5f764 100644 --- a/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed,False).sql +++ b/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(Oracle.23.Managed,False).sql @@ -45,22 +45,24 @@ BeforeExecute -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- Oracle.23.Managed Oracle.Managed Oracle12 diff --git a/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed).sql index 6c78c1a7f91..21f806be602 100644 --- a/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(Oracle.23.Managed).sql @@ -83,10 +83,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 + c_1."ParentID" > 1 AND MOD(c4."ParentID", 2) = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed).sql index cd6563716e7..0b3dae8a1a1 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct2(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)) + Coalesce(p."Value1", MOD(p."ParentID", 2)) FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed).sql index ed841a025f6..7c7eab52dbf 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct3(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed).sql index ed841a025f6..7c7eab52dbf 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct4(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), p."Value1" FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,2).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,2).sql index bae4b253859..3363274dbf1 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,2).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,3).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,3).sql index d08e1bbd8a2..ca1bd087f36 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,3).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,0,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,2).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,2).sql index bae4b253859..3363274dbf1 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,2).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,2).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,3).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,3).sql index d08e1bbd8a2..ca1bd087f36 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,3).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct5(Oracle.23.Managed,1,3).sql @@ -4,7 +4,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", MOD(p."ParentID", 2)), + Coalesce(p."Value1", MOD(p."ParentID", 2)), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,2).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,2).sql index ec068bf34db..3b1fc4fc096 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,2).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,3).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,3).sql index e3b82aebcc0..0da14e0f7f5 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,3).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,0,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,2).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,2).sql index ec068bf34db..3b1fc4fc096 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,2).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,2).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 3 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,3).sql b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,3).sql index e3b82aebcc0..0da14e0f7f5 100644 --- a/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,3).sql +++ b/Oracle.23.Managed/Tests/Linq/DistinctTests/Tests.Linq.DistinctTests.Distinct6(Oracle.23.Managed,1,3).sql @@ -6,7 +6,7 @@ DECLARE @Value1 Int32 SET @Value1 = 4 SELECT DISTINCT - Nvl(p."Value1", p."ParentID" + :ParentID), + Coalesce(p."Value1", p."ParentID" + :ParentID), :Value1 FROM "Parent" p diff --git a/Oracle.23.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed).sql index 98efa34dd6f..3a6cac6a6e0 100644 --- a/Oracle.23.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Oracle.23.Managed).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - a_Children."ParentID", - a_Children."ChildID" + a_Children."ChildID", + a_Children."ParentID" FROM "Child" a_Children WHERE diff --git a/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,1).sql b/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,1).sql index 585ad67f9a0..0fa24faf66d 100644 --- a/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,1).sql +++ b/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,1).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,2).sql b/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,2).sql index 281efc55718..0946272c5a0 100644 --- a/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,2).sql +++ b/Oracle.23.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Oracle.23.Managed,2).sql @@ -9,11 +9,11 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN ( SELECT 'Janet' AS "FirstName", :ID AS "PersonID" FROM sys.dual UNION ALL - SELECT 'Doe', :ID_1 FROM sys.dual) n ON p."PersonID" = n."PersonID" + SELECT 'Doe', :ID_1 FROM sys.dual) n ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/Oracle.23.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed).sql index 301d1255e96..fb54e10b560 100644 --- a/Oracle.23.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Oracle.23.Managed).sql @@ -35,8 +35,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,14).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,14).sql index abb2021d0dc..c5c2ffa1231 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,14).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,15).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,15).sql index 67b18dca185..9d1c0d07de8 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,15).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Oracle.23.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,14).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,14).sql index 0c86e6415df..cab792d4f1f 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,14).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,15).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,15).sql index 984f0f6180e..b7f531deeb4 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,15).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Oracle.23.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,14).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,14).sql index 31d6e797602..d6dc30db5e1 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,14).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,15).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,15).sql index af9cca2fe55..9b58bc36e3a 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,15).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Oracle.23.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :endId - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,14).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,14).sql index 4773beacac4..0446d53c636 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,14).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,14).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,15).sql b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,15).sql index 18897995d7d..fa66ec53e5c 100644 --- a/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,15).sql +++ b/Oracle.23.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Oracle.23.Managed,15).sql @@ -65,10 +65,10 @@ SELECT s."value", s."id" FROM - "sample_class" c_1 + "sample_class" t1 INNER JOIN ( SELECT * FROM "sample_class" where "id" >= :startId and "id" < :p - ) s ON s."id" = c_1."id" + ) s ON s."id" = t1."id" WHERE s."id" > 10 ORDER BY diff --git a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed).sql index 355b0bad8f2..3e052bfb291 100644 --- a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.AggregateAssociation(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - SUM(Nvl(a_Parent."Value1", 0)) + SUM(Coalesce(a_Parent."Value1", 0)) FROM "Child" grp LEFT JOIN "Parent" a_Parent ON grp."ParentID" = a_Parent."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed).sql index ccbd4055a3f..f4d0d6a8aaf 100644 --- a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy2(Oracle.23.Managed).sql @@ -7,7 +7,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as ID + Coalesce(gr."Value1", c_1."ChildID") as ID FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed).sql index 1c22fabd4d1..67e9295ae53 100644 --- a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupBy3(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ SELECT FROM ( SELECT - Nvl(gr."Value1", c_1."ChildID") as "c1" + Coalesce(gr."Value1", c_1."ChildID") as "c1" FROM "Parent" gr INNER JOIN "Child" c_1 ON gr."ParentID" = c_1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed).sql index 3c9150f33d0..d1a6d5d8e8f 100644 --- a/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.GroupByExpression(Oracle.23.Managed).sql @@ -4,7 +4,7 @@ DECLARE @defValue Int32 SET @defValue = 10 SELECT - Nvl(MIN(gr."ParentID"), :defValue) + Coalesce(MIN(gr."ParentID"), :defValue) FROM "Parent" gr diff --git a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,False).sql b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,False).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,False).sql +++ b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,True).sql b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,True).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,True).sql +++ b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,False,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,False).sql b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,False).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,False).sql +++ b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,False).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,True).sql b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,True).sql index 981a09b3b9d..395d25e26b4 100644 --- a/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,True).sql +++ b/Oracle.23.Managed/Tests/Linq/InSubqueryTests/Tests.Linq.InSubqueryTests.ObjectInTest(Oracle.23.Managed,True,True).sql @@ -13,7 +13,7 @@ WHERE FROM "Parent" param WHERE - param."ParentID" = c_1."ParentID" AND Nvl(param."Value1", -1) = c_1."ParentID" + param."ParentID" = c_1."ParentID" AND Coalesce(param."Value1", -1) = c_1."ParentID" ) BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed).sql index 52f6de06162..7ce17cfd527 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Oracle.23.Managed).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Nvl(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as "c1" + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2."c1" LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed).sql index f1151be8a02..fd90728323b 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test1(Oracle.23.Managed).sql @@ -223,8 +223,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed).sql index 80c5bd43b06..216ee556bbf 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.Issue1455Test2(Oracle.23.Managed).sql @@ -213,8 +213,8 @@ FROM trade_2."DealId", trade_2."ParcelId", trade_2."CounterParty", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate", - Nvl(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate", + Coalesce(t1.MAX_1, t1."CreationDate") as "LastUpdate_1" FROM ( SELECT diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed).sql index ea9e010e1b8..a6e88412acf 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed).sql index fa86e27d3e4..c9d1ed0acea 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_2."left_1", + t2."left_1", t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2."left_1" + ) t1 ON t1."ParentID" = t2."left_1" ORDER BY - left_2."left_1" + t2."left_1" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql index 9f1da9e986a..8e19748c33e 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql index 4fac63ca0aa..be88a7d7a98 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql index 27430b4d97c..0a7cf431eb5 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql index 92608d79a4c..ff39521fe30 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 FULL JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql index 8928aeb6c69..d5d663a3ade 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_1."Value1" OR right_2."c1" IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql index d9679041624..0aa1ba5f5db 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Oracle.23.Managed).sql @@ -2,13 +2,13 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql index affc383de6a..0963e707b17 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Oracle.23.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql index 5e3fdebf628..a461d828221 100644 --- a/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Oracle.23.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2."c1" = left_2."Value1" OR right_2."c1" IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2."c1" = t1."Value1" OR right_2."c1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed).sql index 111e4fc2d2a..9318f0aec88 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Oracle.23.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute @@ -107,13 +107,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed).sql index 1fa53e9833b..f1001849b88 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Oracle.23.Managed).sql @@ -77,13 +77,13 @@ DECLARE @take Int32 SET @take = 3 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(MOD(g_1."OrderData1", 3)) + MAX(MOD(x."OrderData1", 3)) OFFSET :skip ROWS FETCH NEXT :take ROWS ONLY BeforeExecute diff --git a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed).sql index ef33ef465b0..ca510bffb9e 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Oracle.23.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" DESC + MOD(ch."ChildID", 2), + ch."ChildID" DESC diff --git a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed).sql index d4fd2a3d787..e728abd9494 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Oracle.23.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + x."ChildID", + MOD(x."ChildID", 2) diff --git a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed).sql index d4fd2a3d787..189f202aafb 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Oracle.23.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2), - x."ChildID" + MOD(ch."ChildID", 2), + ch."ChildID" diff --git a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed).sql index a98ed95d10b..b8162d6401e 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Oracle.23.Managed).sql @@ -2,11 +2,11 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - MOD(x."ChildID", 2) DESC, - x."ChildID" DESC + MOD(ch."ChildID", 2) DESC, + ch."ChildID" DESC diff --git a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed).sql index 89c81bd4201..cfecd9aefd9 100644 --- a/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Oracle.23.Managed).sql @@ -2,17 +2,21 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2.ID, + t2."LastName", + t2."flag" FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + t1."PersonID" as ID, + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + t2."flag" diff --git a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed).sql index 0a0e8649145..891cef13828 100644 --- a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce4(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT a_Parent."Value1" FROM diff --git a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed).sql index e66682c55a1..23d92d375d8 100644 --- a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.Coalesce5(Oracle.23.Managed).sql @@ -2,7 +2,7 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(( + Coalesce(( SELECT MAX(a_Children."ChildID") FROM diff --git a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.23.Managed).sql new file mode 100644 index 00000000000..3d92c4cda81 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Oracle.23.Managed).sql @@ -0,0 +1,82 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE ' + CREATE TABLE "CoalesceNullableFields" + ( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") + ) + '; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -955 THEN + RAISE; + END IF; +END; + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +INSERT ALL + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (1,10,NULL,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (2,NULL,20,NULL) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (3,NULL,NULL,30) + INTO "CoalesceNullableFields" ("Id", "Nullable1", "Nullable2", "Nullable3") VALUES (4,NULL,NULL,NULL) +SELECT * FROM dual + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +BEGIN + EXECUTE IMMEDIATE 'DROP TABLE "CoalesceNullableFields"'; +EXCEPTION + WHEN OTHERS THEN + IF SQLCODE != -942 THEN + RAISE; + END IF; +END; + diff --git a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.23.Managed).sql index 9c11012c391..d6810ca29ea 100644 --- a/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(Oracle.23.Managed).sql @@ -2,38 +2,28 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p OUTER APPLY ( @@ -110,5 +110,5 @@ FROM ) t5 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.23.Managed).sql index 828539888d4..45b28accd34 100644 --- a/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceConcatTest(Oracle.23.Managed).sql @@ -64,16 +64,16 @@ SELECT FROM ( SELECT - Nvl(t1."EnumNullable", t1."Enum") as "Converted1", + Coalesce(t1."EnumNullable", t1."Enum") as "Converted1", t1."Value1" as "Converted2" FROM "ValueConversion" t1 ) t2 UNION SELECT - Nvl(t1_1."EnumNullable", t1_1."Enum"), + Coalesce(t1_1."EnumNullable", t1_1."Enum"), t1_1."Value1", - Nvl(t1_1."EnumNullable", t1_1."Enum") + Coalesce(t1_1."EnumNullable", t1_1."Enum") FROM "ValueConversion" t1_1 diff --git a/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.23.Managed).sql index 12610d30f78..3f8514efee7 100644 --- a/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/ValueConversionTests/Tests.Linq.ValueConversionTests.CoalesceTest(Oracle.23.Managed).sql @@ -58,7 +58,7 @@ BeforeExecute -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - Nvl(t1."EnumNullable", t1."Enum") + Coalesce(t1."EnumNullable", t1."Enum") FROM "ValueConversion" t1 diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.23.Managed).sql new file mode 100644 index 00000000000..88fa992127c --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Oracle.23.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.23.Managed).sql new file mode 100644 index 00000000000..0637a756352 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Oracle.23.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed).sql index c71df95bb54..0637a756352 100644 --- a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Oracle.23.Managed).sql @@ -2,17 +2,10 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed).sql index 9d32afe5486..a6e1205bb6c 100644 --- a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Oracle.23.Managed).sql @@ -2,14 +2,10 @@ -- Oracle.23.Managed Oracle.Managed Oracle12 SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.23.Managed).sql new file mode 100644 index 00000000000..8608943cd62 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Oracle.23.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.23.Managed).sql new file mode 100644 index 00000000000..9c01b08825f --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Oracle.23.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.23.Managed).sql new file mode 100644 index 00000000000..a6e1205bb6c --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Oracle.23.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.23.Managed).sql new file mode 100644 index 00000000000..303d54a3514 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Oracle.23.Managed).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.23.Managed).sql new file mode 100644 index 00000000000..c71df95bb54 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Oracle.23.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.23.Managed).sql new file mode 100644 index 00000000000..9d32afe5486 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Oracle.23.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed).sql index f543194b34c..24d3de9cbc3 100644 --- a/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Oracle.23.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT DISTINCT c_2."ParentID", @@ -26,9 +26,9 @@ FROM FROM "Child" t1 ) c_2 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID", + t3."ParentID", t2."ChildID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed).sql index f8ea6e4c5ce..81789b00130 100644 --- a/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(Oracle.23.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed).sql index 8edaa61242a..71626c5762d 100644 --- a/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(Oracle.23.Managed).sql @@ -4,10 +4,10 @@ DECLARE @take Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" FETCH NEXT :take ROWS ONLY diff --git a/Oracle.23.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed).sql index 2c14a6149a2..36211a90b5c 100644 --- a/Oracle.23.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/UserTests/Issue873Tests/Tests.UserTests.Issue873Tests.Test(Oracle.23.Managed).sql @@ -9,7 +9,7 @@ SELECT FROM ( SELECT - ' ' || CAST(Nvl(f."Value1", 0) AS VarChar(255)) as "Label", + ' ' || CAST(Coalesce(f."Value1", 0) AS VarChar(255)) as "Label", ( SELECT SUM(c_1."ChildID") diff --git a/Oracle.23.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed).sql index d102b09a1f0..dc07c59f17b 100644 --- a/Oracle.23.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/UserTests/Test4415/Test4415Tests/Tests.UserTests.Test4415.Test4415Tests.TestIssue4415_Test5(Oracle.23.Managed).sql @@ -60,7 +60,7 @@ WHERE FROM ( SELECT - Nvl(MAX(x_1."LanguageID"), '') || 'test' as "c1" + Coalesce(MAX(x_1."LanguageID"), '') || 'test' as "c1" FROM "Common_Language" x_1 GROUP BY diff --git a/Oracle.23.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed).sql index bbb5c5fe70d..2ef66644319 100644 --- a/Oracle.23.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed).sql +++ b/Oracle.23.Managed/Tests/xUpdate/InsertTests/Tests.xUpdate.InsertTests.InsertUnion1(Oracle.23.Managed).sql @@ -26,8 +26,8 @@ FROM "Child" c_1 UNION SELECT - Nvl(c_2."ParentID", 0) as "ParentID", - Floor(CAST(Nvl(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" + Coalesce(c_2."ParentID", 0) as "ParentID", + Floor(CAST(Coalesce(c_2."GrandChildID", 0) AS Float) / 100D) as "Value1" FROM "GrandChild" c_2 ) t1 diff --git a/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11.LinqService,False).sql b/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11.LinqService,False).sql index 57efd89e8b1..407ba6f94cd 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11.LinqService,False).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11.LinqService).sql index daaf5130584..63749e784db 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11.LinqService).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11.LinqService).sql index 5ed5b4f83c1..2a61b7b2f72 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11.LinqService).sql @@ -288,7 +288,7 @@ BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -296,11 +296,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11.LinqService).sql index 1b82b2c48d3..c088952ed82 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,1).sql b/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,1).sql index ea2a81dd12d..d7608fd9c73 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,1).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,2).sql b/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,2).sql index 4adcb226ea7..5cfa1505d54 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,2).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11.LinqService).sql index 3bd237408b0..dc8008e98fb 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,14).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,14).sql index 5ccfda5b981..0a673b276c8 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,14).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,15).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,15).sql index df79e56f359..0ba9fed8f39 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,15).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,14).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,14).sql index 2272357eb96..92273a521a0 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,14).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,15).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,15).sql index 459c45d45c9..d735e4cdcff 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,15).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,14).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,14).sql index 5c745435d37..1cc82792b41 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,14).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,15).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,15).sql index e89ded4c6af..a35f01b798e 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,15).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,14).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,14).sql index 189cc674508..5f3913c93ed 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,14).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,15).sql b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,15).sql index 9196936aa50..c43fb87aa73 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,15).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11.LinqService).sql index 31bfca3dff8..a54fa68fffd 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11.LinqService).sql index 2613ece6c21..bb91befe84f 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11.LinqService).sql index eaf10ab708a..5e178a6465e 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11.LinqService).sql index e2943337665..d8e2a14ee7c 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11.LinqService).sql index bbfd94db75b..0b90e3784dc 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11.LinqService).sql @@ -2,13 +2,13 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11.LinqService).sql index 5b22f658e3d..4dad1ad50e6 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11.LinqService).sql index 2ad9b1391ad..83c435ecdff 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11.LinqService).sql index a7e22d984da..3002575713e 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11.LinqService).sql index a5e82c0695e..69eeb52dcf1 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11.LinqService).sql index a770d8085ca..9b679269547 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11.LinqService).sql index 53c149984e5..9c6a6e78f3f 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11.LinqService).sql index 53c149984e5..04eff039861 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11.LinqService).sql index ee4ff0caaad..01bae8f7005 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11.LinqService).sql index bfa2991915c..9fca26abd88 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11.LinqService).sql @@ -2,17 +2,21 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.11.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..930c1f45ec8 --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.11.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..687c47ab8a2 --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.11.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..f9a3734f4cd --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11.LinqService).sql index b74bf4d3c21..f9a3734f4cd 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11.LinqService).sql @@ -2,17 +2,10 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11.LinqService).sql index 7e65b96e23d..7318dcf3228 100644 --- a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11.LinqService).sql @@ -2,14 +2,10 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..447630cac26 --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..6c665d4b7a0 --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..7318dcf3228 --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.11.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..8f5b0096a3a --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.11.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..b74bf4d3c21 --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.11.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.11.LinqService).sql new file mode 100644 index 00000000000..7e65b96e23d --- /dev/null +++ b/PostgreSQL.11.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.11.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11.LinqService).sql index 1cc0300a082..18246c09135 100644 --- a/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11.LinqService).sql b/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11.LinqService).sql index d8b08884246..6ea83879e3d 100644 --- a/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11.LinqService).sql +++ b/PostgreSQL.11.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11,False).sql b/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11,False).sql index 69b3f750681..d18a71c1ac2 100644 --- a/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11,False).sql +++ b/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.11,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11).sql index daaf5130584..63749e784db 100644 --- a/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.11).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11).sql index eca213a44e9..04877bffa2a 100644 --- a/PostgreSQL.11/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.11).sql @@ -73,7 +73,7 @@ BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -81,11 +81,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11).sql index 1b82b2c48d3..c088952ed82 100644 --- a/PostgreSQL.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.11).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,1).sql b/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,1).sql index ea2a81dd12d..d7608fd9c73 100644 --- a/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,1).sql +++ b/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,2).sql b/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,2).sql index 4adcb226ea7..5cfa1505d54 100644 --- a/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,2).sql +++ b/PostgreSQL.11/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.11,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11).sql index 3bd237408b0..dc8008e98fb 100644 --- a/PostgreSQL.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.11).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,14).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,14).sql index b644c6a58e9..c9a3cb05f0b 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,14).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,15).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,15).sql index c9f779867c6..f73d6478881 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,15).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.11,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,14).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,14).sql index 0379bfac8a9..dddb75c7077 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,14).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,15).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,15).sql index b073d5120cf..9ad38a8dd59 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,15).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.11,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,14).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,14).sql index a8f9af66250..eefc87277b2 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,14).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,15).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,15).sql index 73d5928febb..8c2865d9259 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,15).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.11,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,14).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,14).sql index 4d9e1156566..4307d7b43d0 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,14).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,15).sql b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,15).sql index b85777ce115..545435f4fc5 100644 --- a/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,15).sql +++ b/PostgreSQL.11/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.11,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11).sql index 31bfca3dff8..a54fa68fffd 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.11).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11).sql index 2613ece6c21..bb91befe84f 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.11).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11).sql index eaf10ab708a..5e178a6465e 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.11).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11).sql index e2943337665..d8e2a14ee7c 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.11).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11).sql index bbfd94db75b..0b90e3784dc 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.11).sql @@ -2,13 +2,13 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11).sql index 5b22f658e3d..4dad1ad50e6 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.11).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11).sql index 2ad9b1391ad..83c435ecdff 100644 --- a/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.11).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11).sql index 279d90290af..e625884dbd9 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.11).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11).sql index 5d5eeb8eb43..860625ca4e8 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.11).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11).sql index a770d8085ca..9b679269547 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.11).sql @@ -2,11 +2,11 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11).sql index 53c149984e5..9c6a6e78f3f 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.11).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11).sql index 53c149984e5..04eff039861 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.11).sql @@ -2,11 +2,11 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11).sql index ee4ff0caaad..01bae8f7005 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.11).sql @@ -2,11 +2,11 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11).sql index bfa2991915c..9fca26abd88 100644 --- a/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.11).sql @@ -2,17 +2,21 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.11).sql new file mode 100644 index 00000000000..6a3c832c258 --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.11).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.11).sql index 50b941f8a39..250051ff342 100644 --- a/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.11).sql @@ -2,38 +2,28 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN True ELSE False - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) t5 ON 1=1 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.11).sql new file mode 100644 index 00000000000..687c47ab8a2 --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.11).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.11).sql new file mode 100644 index 00000000000..f9a3734f4cd --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11).sql index b74bf4d3c21..f9a3734f4cd 100644 --- a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.11).sql @@ -2,17 +2,10 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11).sql index 7e65b96e23d..7318dcf3228 100644 --- a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.11).sql @@ -2,14 +2,10 @@ -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.11).sql new file mode 100644 index 00000000000..447630cac26 --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.11).sql new file mode 100644 index 00000000000..6c665d4b7a0 --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.11).sql new file mode 100644 index 00000000000..7318dcf3228 --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.11).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.11).sql new file mode 100644 index 00000000000..8f5b0096a3a --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.11).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.11).sql new file mode 100644 index 00000000000..b74bf4d3c21 --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.11).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.11).sql b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.11).sql new file mode 100644 index 00000000000..7e65b96e23d --- /dev/null +++ b/PostgreSQL.11/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.11).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.11/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.11).sql b/PostgreSQL.11/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.11).sql index 1a5670a090c..427dc5d4384 100644 --- a/PostgreSQL.11/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.11).sql @@ -78,21 +78,21 @@ FROM SELECT t1."AppSubTypeId", t1."Description", - t1."MAX_1" as "MaxSubtypeCreatedDate", - t1."MAX_2" as "MaxTypeCreatedDate", - t1."MAX_3" as "MaxTypeId", - t1."CountExt" as "CountDistinctTypeId", - t1."CountExt_1" as "CountDistinctSubTypeId" + t1."MaxSubtypeCreatedDate", + t1."MaxTypeCreatedDate", + t1."MaxTypeId", + t1."CountDistinctTypeId", + t1."CountDistinctSubTypeId" FROM ( SELECT - COUNT(DISTINCT type_1."AppTypeId") as "CountExt", - MAX(subtype_1."CreatedDate") as "MAX_1", - MAX(type_1."CreatedDate") as "MAX_2", - MAX(type_1."AppTypeId") as "MAX_3", + COUNT(DISTINCT type_1."AppTypeId") as "CountDistinctTypeId", + MAX(subtype_1."CreatedDate") as "MaxSubtypeCreatedDate", + MAX(type_1."CreatedDate") as "MaxTypeCreatedDate", + MAX(type_1."AppTypeId") as "MaxTypeId", subtype_1."AppSubTypeId", subtype_1."Description", - COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountExt_1" + COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountDistinctSubTypeId" FROM "ItemAppType" grpby LEFT JOIN "AppType" type_1 ON type_1."AppTypeId" = grpby."AppTypeId" @@ -105,10 +105,10 @@ FROM subtype_1."AppSubTypeId" ) t1 ORDER BY - t1."CountExt" DESC, - t1."MAX_1" DESC, - t1."MAX_2" DESC, - t1."MAX_3" DESC + t1."CountDistinctTypeId" DESC, + t1."MaxSubtypeCreatedDate" DESC, + t1."MaxTypeCreatedDate" DESC, + t1."MaxTypeId" DESC LIMIT 1 ) t2 ON 1=1 WHERE diff --git a/PostgreSQL.11/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.11).sql b/PostgreSQL.11/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.11).sql index da8c4c162a7..c140f4ef44a 100644 --- a/PostgreSQL.11/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.11).sql @@ -122,7 +122,7 @@ BeforeExecute -- PostgreSQL.11 PostgreSQL.9.5 PostgreSQL SELECT - t5."SUM_1", + t5."WithParentReference", t5."WithParentReferenceCustom1", t5."WithParentReferenceCustom2", t5."WithoutParentReference" @@ -153,7 +153,7 @@ FROM WHERE "a_Employee"."EmployeeId" = e."EmployeeId" ) d ON 1=1 - ) as "SUM_1", + ) as "WithParentReference", ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN "Employee" "a_Employee" ON tracking."EmployeeId" = "a_Employee"."EmployeeId" ) t5 ORDER BY - Coalesce(t5."SUM_1", 0), + Coalesce(t5."WithParentReference", 0), Coalesce(t5."WithParentReferenceCustom1", 0), Coalesce(t5."WithParentReferenceCustom2", 0), Coalesce(t5."WithoutParentReference", 0) DESC diff --git a/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11).sql b/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11).sql index 1cc0300a082..18246c09135 100644 --- a/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.11).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11).sql b/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11).sql index d8b08884246..6ea83879e3d 100644 --- a/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11).sql +++ b/PostgreSQL.11/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.11).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,2).sql b/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,2).sql index ea525b7265e..2e827b300f8 100644 --- a/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,2).sql +++ b/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,2).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 2 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,85).sql b/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,85).sql index fda1c58d69c..03444aa46f4 100644 --- a/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,85).sql +++ b/PostgreSQL.11/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.11,85).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 85 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12.LinqService,False).sql b/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12.LinqService,False).sql index 661d61be29d..393c28929c4 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12.LinqService,False).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12.LinqService).sql index 171a74e1aa1..93d11c30c7d 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12.LinqService).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12.LinqService).sql index 5e801ae83fc..cba884632b4 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12.LinqService).sql @@ -288,7 +288,7 @@ BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -296,11 +296,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.12.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12.LinqService).sql index 55dd561febe..154f0117d68 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,1).sql b/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,1).sql index 5b30b9a21fb..891c4cf0c19 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,1).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,2).sql b/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,2).sql index 2622a5d1ada..b7268f06dc5 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,2).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12.LinqService).sql index c5a37bfc774..5125f914ee8 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,14).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,14).sql index 6d7319601cb..61f41c386f5 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,14).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,15).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,15).sql index 9e564c29b69..b943849c393 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,15).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,14).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,14).sql index 930c24905d8..a0c3e7c80ea 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,14).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,15).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,15).sql index a921f13e5bd..d30c944462f 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,15).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,14).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,14).sql index ab2add30b06..b5906ccd6d0 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,14).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,15).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,15).sql index c373bfe0245..1adc9341bc6 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,15).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,14).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,14).sql index 4e01e703304..5037bf0cc8d 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,14).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,15).sql b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,15).sql index baa6ac2a7d6..5498d7d1d1e 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,15).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12.LinqService).sql index 5ec5c826a85..debdeb2830f 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12.LinqService).sql index d6d05a27bae..a8ec36b205f 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12.LinqService).sql index 7129b28dcda..b298aa5ccc3 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12.LinqService).sql index 4515e360091..3ca79279527 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12.LinqService).sql index cdecfa75b45..62928bfb565 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12.LinqService).sql @@ -2,13 +2,13 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12.LinqService).sql index 879e7a4a29c..326d5577dce 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12.LinqService).sql index 4d9bcc8a73a..32ecc532e72 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12.LinqService).sql index a737d31468c..7e919cfccff 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12.LinqService).sql index 3db79eec6f5..81b478fef5a 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12.LinqService).sql index 87a5cd66fb2..24d6c624f90 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12.LinqService).sql index eddada468ae..cc2ede3644e 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12.LinqService).sql index eddada468ae..cd72453cdd9 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12.LinqService).sql index 914b997e354..bf89cc89e1d 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12.LinqService).sql index bd51eaa9145..d7392992f8f 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12.LinqService).sql @@ -2,17 +2,21 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.12.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..8ce761a90e1 --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.12.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..82b845a8a52 --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.12.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..fddca5665d0 --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.12.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12.LinqService).sql index c5b33c04e95..fddca5665d0 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12.LinqService).sql @@ -2,17 +2,10 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12.LinqService).sql index 44f79c4e2bd..a9742a7c713 100644 --- a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12.LinqService).sql @@ -2,14 +2,10 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..4dda630d800 --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.12.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..921b8bd2b0d --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.12.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..a9742a7c713 --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.12.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..541d71cb2bc --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.12.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..c5b33c04e95 --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.12.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.12.LinqService).sql new file mode 100644 index 00000000000..44f79c4e2bd --- /dev/null +++ b/PostgreSQL.12.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.12.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12.LinqService).sql index ad3828195f3..9ebbaeb1e12 100644 --- a/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12.LinqService).sql b/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12.LinqService).sql index c00ea1af8e8..ece4a082bd2 100644 --- a/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12.LinqService).sql +++ b/PostgreSQL.12.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12,False).sql b/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12,False).sql index 1140b67603b..0fee4aedc31 100644 --- a/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12,False).sql +++ b/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.12,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12).sql index 171a74e1aa1..93d11c30c7d 100644 --- a/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.12).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12).sql index fc443d83d6e..3b730de631f 100644 --- a/PostgreSQL.12/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.12).sql @@ -73,7 +73,7 @@ BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -81,11 +81,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.12/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12).sql index 55dd561febe..154f0117d68 100644 --- a/PostgreSQL.12/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.12).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,1).sql b/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,1).sql index 5b30b9a21fb..891c4cf0c19 100644 --- a/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,1).sql +++ b/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,2).sql b/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,2).sql index 2622a5d1ada..b7268f06dc5 100644 --- a/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,2).sql +++ b/PostgreSQL.12/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.12,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.12/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12).sql index c5a37bfc774..5125f914ee8 100644 --- a/PostgreSQL.12/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.12).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,14).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,14).sql index f7dcec31ccf..8eb4a47f848 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,14).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,15).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,15).sql index 950a148b177..fdc2ae2530f 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,15).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.12,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,14).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,14).sql index 1585b936f33..2c614ce1f0f 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,14).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,15).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,15).sql index 7b27ee0f867..2dff65fdd8f 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,15).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.12,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,14).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,14).sql index 145f041e9d4..faaf300c68e 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,14).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,15).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,15).sql index 4d814e90534..e2720c8f8a0 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,15).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.12,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,14).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,14).sql index 622e491c731..050baaa6a57 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,14).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,15).sql b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,15).sql index 57ae136cdfb..11c99d2f824 100644 --- a/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,15).sql +++ b/PostgreSQL.12/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.12,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12).sql index 5ec5c826a85..debdeb2830f 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.12).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12).sql index d6d05a27bae..a8ec36b205f 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.12).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12).sql index 7129b28dcda..b298aa5ccc3 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.12).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12).sql index 4515e360091..3ca79279527 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.12).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12).sql index cdecfa75b45..62928bfb565 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.12).sql @@ -2,13 +2,13 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12).sql index 879e7a4a29c..326d5577dce 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.12).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12).sql index 4d9bcc8a73a..32ecc532e72 100644 --- a/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.12).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12).sql index 2077f7c1495..1e3b4acb144 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.12).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12).sql index 3c993f27aaf..6bd8bed549f 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.12).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12).sql index 87a5cd66fb2..24d6c624f90 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.12).sql @@ -2,11 +2,11 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12).sql index eddada468ae..cc2ede3644e 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.12).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12).sql index eddada468ae..cd72453cdd9 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.12).sql @@ -2,11 +2,11 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12).sql index 914b997e354..bf89cc89e1d 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.12).sql @@ -2,11 +2,11 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12).sql index bd51eaa9145..d7392992f8f 100644 --- a/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.12).sql @@ -2,17 +2,21 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.12).sql new file mode 100644 index 00000000000..1de0e7f5216 --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.12).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.12).sql index 7fb0e496997..707af722708 100644 --- a/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.12).sql @@ -2,38 +2,28 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN True ELSE False - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) t5 ON 1=1 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.12).sql new file mode 100644 index 00000000000..82b845a8a52 --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.12).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.12).sql new file mode 100644 index 00000000000..fddca5665d0 --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.12).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12).sql index c5b33c04e95..fddca5665d0 100644 --- a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.12).sql @@ -2,17 +2,10 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12).sql index 44f79c4e2bd..a9742a7c713 100644 --- a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.12).sql @@ -2,14 +2,10 @@ -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.12).sql new file mode 100644 index 00000000000..4dda630d800 --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.12).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.12).sql new file mode 100644 index 00000000000..921b8bd2b0d --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.12).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.12).sql new file mode 100644 index 00000000000..a9742a7c713 --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.12).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.12).sql new file mode 100644 index 00000000000..541d71cb2bc --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.12).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.12).sql new file mode 100644 index 00000000000..c5b33c04e95 --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.12).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.12).sql b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.12).sql new file mode 100644 index 00000000000..44f79c4e2bd --- /dev/null +++ b/PostgreSQL.12/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.12).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.12/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.12).sql b/PostgreSQL.12/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.12).sql index a411d33727d..b80b0c07136 100644 --- a/PostgreSQL.12/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.12).sql @@ -78,21 +78,21 @@ FROM SELECT t1."AppSubTypeId", t1."Description", - t1."MAX_1" as "MaxSubtypeCreatedDate", - t1."MAX_2" as "MaxTypeCreatedDate", - t1."MAX_3" as "MaxTypeId", - t1."CountExt" as "CountDistinctTypeId", - t1."CountExt_1" as "CountDistinctSubTypeId" + t1."MaxSubtypeCreatedDate", + t1."MaxTypeCreatedDate", + t1."MaxTypeId", + t1."CountDistinctTypeId", + t1."CountDistinctSubTypeId" FROM ( SELECT - COUNT(DISTINCT type_1."AppTypeId") as "CountExt", - MAX(subtype_1."CreatedDate") as "MAX_1", - MAX(type_1."CreatedDate") as "MAX_2", - MAX(type_1."AppTypeId") as "MAX_3", + COUNT(DISTINCT type_1."AppTypeId") as "CountDistinctTypeId", + MAX(subtype_1."CreatedDate") as "MaxSubtypeCreatedDate", + MAX(type_1."CreatedDate") as "MaxTypeCreatedDate", + MAX(type_1."AppTypeId") as "MaxTypeId", subtype_1."AppSubTypeId", subtype_1."Description", - COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountExt_1" + COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountDistinctSubTypeId" FROM "ItemAppType" grpby LEFT JOIN "AppType" type_1 ON type_1."AppTypeId" = grpby."AppTypeId" @@ -105,10 +105,10 @@ FROM subtype_1."AppSubTypeId" ) t1 ORDER BY - t1."CountExt" DESC, - t1."MAX_1" DESC, - t1."MAX_2" DESC, - t1."MAX_3" DESC + t1."CountDistinctTypeId" DESC, + t1."MaxSubtypeCreatedDate" DESC, + t1."MaxTypeCreatedDate" DESC, + t1."MaxTypeId" DESC LIMIT 1 ) t2 ON 1=1 WHERE diff --git a/PostgreSQL.12/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.12).sql b/PostgreSQL.12/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.12).sql index e724a27c54e..46c814dcfd0 100644 --- a/PostgreSQL.12/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.12).sql @@ -122,7 +122,7 @@ BeforeExecute -- PostgreSQL.12 PostgreSQL.9.5 PostgreSQL SELECT - t5."SUM_1", + t5."WithParentReference", t5."WithParentReferenceCustom1", t5."WithParentReferenceCustom2", t5."WithoutParentReference" @@ -153,7 +153,7 @@ FROM WHERE "a_Employee"."EmployeeId" = e."EmployeeId" ) d ON 1=1 - ) as "SUM_1", + ) as "WithParentReference", ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN "Employee" "a_Employee" ON tracking."EmployeeId" = "a_Employee"."EmployeeId" ) t5 ORDER BY - Coalesce(t5."SUM_1", 0), + Coalesce(t5."WithParentReference", 0), Coalesce(t5."WithParentReferenceCustom1", 0), Coalesce(t5."WithParentReferenceCustom2", 0), Coalesce(t5."WithoutParentReference", 0) DESC diff --git a/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12).sql b/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12).sql index ad3828195f3..9ebbaeb1e12 100644 --- a/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.12).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12).sql b/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12).sql index c00ea1af8e8..ece4a082bd2 100644 --- a/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12).sql +++ b/PostgreSQL.12/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.12).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,2).sql b/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,2).sql index fe56ec341f4..fdadb794635 100644 --- a/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,2).sql +++ b/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,2).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 2 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,85).sql b/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,85).sql index c66cb18c4c0..788aafb64f9 100644 --- a/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,85).sql +++ b/PostgreSQL.12/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.12,85).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 85 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13.LinqService,False).sql b/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13.LinqService,False).sql index 725049ad2ae..fab57d08c47 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13.LinqService,False).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13.LinqService).sql index 9ec00667eb8..92023684e91 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13.LinqService).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13.LinqService).sql index 16017f6b431..5f123caf28c 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13.LinqService).sql @@ -288,7 +288,7 @@ BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -296,11 +296,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.13.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13.LinqService).sql index c7d53692004..b0bf8299e85 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,1).sql b/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,1).sql index d9734b4e0d4..86c440b59ff 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,1).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,2).sql b/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,2).sql index c4d7794209e..2aad31b2d63 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,2).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13.LinqService).sql index 2df126e1e5c..8ee982a8cf3 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,14).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,14).sql index d2ef1cabbf2..d3f7a854dd8 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,14).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,15).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,15).sql index cde61e1f3ac..41d311fea76 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,15).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,14).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,14).sql index fe4a715be50..b182b49e6c7 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,14).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,15).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,15).sql index 6cbb9c42960..9f9cdb86613 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,15).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,14).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,14).sql index c548b558239..e1b18fab176 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,14).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,15).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,15).sql index 58e11eb310a..de33557c5f9 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,15).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,14).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,14).sql index 5c1988a3573..ab4c08f8806 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,14).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,15).sql b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,15).sql index 5fc3e4fb839..0475414b00e 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,15).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13.LinqService).sql index cffa1f89770..9fb86aeaf20 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13.LinqService).sql index 3e46ff09155..c62a80dcbe1 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13.LinqService).sql index e4c8921d0de..4c2be0cd647 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13.LinqService).sql index 3bc4a35d603..25508a68223 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13.LinqService).sql index 5231648a497..ab211a6b4a0 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13.LinqService).sql @@ -2,13 +2,13 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13.LinqService).sql index 42c2d33eee1..89112b1173f 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13.LinqService).sql index d42d03de1ee..5a5cbd6f5a4 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13.LinqService).sql index 96ebdac25e8..42f4073c0a7 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13.LinqService).sql index e27a5514e82..172e4d0eee0 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13.LinqService).sql index 6010dd9282b..ce2da9e00e9 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13.LinqService).sql index 1cdea0ec7d1..42a6a7bbaef 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13.LinqService).sql index 1cdea0ec7d1..74e4327857a 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13.LinqService).sql index 03788533e22..87ca18b1c4f 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13.LinqService).sql index 987f7e2547d..7e0d5288f19 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13.LinqService).sql @@ -2,17 +2,21 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.13.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..37961034dcf --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.13.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..0cccf8b8fff --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.13.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..004e151d86e --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.13.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13.LinqService).sql index 5c7c5cc7155..004e151d86e 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13.LinqService).sql @@ -2,17 +2,10 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13.LinqService).sql index 190ee8790f5..ef8eaad15e9 100644 --- a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13.LinqService).sql @@ -2,14 +2,10 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..effbe0c30b8 --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.13.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..a2d3a1ff509 --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.13.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..ef8eaad15e9 --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.13.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..b60aba48425 --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.13.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..5c7c5cc7155 --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.13.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.13.LinqService).sql new file mode 100644 index 00000000000..190ee8790f5 --- /dev/null +++ b/PostgreSQL.13.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.13.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13.LinqService).sql index 4910a66c88b..0462e9765ad 100644 --- a/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13.LinqService).sql b/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13.LinqService).sql index 67846498aa6..9a7f8ca1660 100644 --- a/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13.LinqService).sql +++ b/PostgreSQL.13.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13,False).sql b/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13,False).sql index 2304960f929..7c7040dd180 100644 --- a/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13,False).sql +++ b/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.13,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13).sql index 9ec00667eb8..92023684e91 100644 --- a/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.13).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13).sql index 16246fd0883..03352b0b0df 100644 --- a/PostgreSQL.13/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.13).sql @@ -73,7 +73,7 @@ BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -81,11 +81,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.13/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13).sql index c7d53692004..b0bf8299e85 100644 --- a/PostgreSQL.13/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.13).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,1).sql b/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,1).sql index d9734b4e0d4..86c440b59ff 100644 --- a/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,1).sql +++ b/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,2).sql b/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,2).sql index c4d7794209e..2aad31b2d63 100644 --- a/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,2).sql +++ b/PostgreSQL.13/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.13,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.13/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13).sql index 2df126e1e5c..8ee982a8cf3 100644 --- a/PostgreSQL.13/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.13).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,14).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,14).sql index ca4ac5b0f26..7fd6a9e577e 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,14).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,15).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,15).sql index aeed1b4754e..940f5f6b309 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,15).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.13,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,14).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,14).sql index e0d50c0ea34..e712be83aff 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,14).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,15).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,15).sql index 6df2193e9a3..59143c0670e 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,15).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.13,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,14).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,14).sql index 18fb420cf72..6bdcce580bb 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,14).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,15).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,15).sql index 9c2398bc024..b9972ede592 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,15).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.13,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,14).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,14).sql index 742e38f2183..c9dc1f5b07b 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,14).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,15).sql b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,15).sql index f8b810d2a1a..33c73652b9f 100644 --- a/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,15).sql +++ b/PostgreSQL.13/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.13,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13).sql index cffa1f89770..9fb86aeaf20 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.13).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13).sql index 3e46ff09155..c62a80dcbe1 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.13).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13).sql index e4c8921d0de..4c2be0cd647 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.13).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13).sql index 3bc4a35d603..25508a68223 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.13).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13).sql index 5231648a497..ab211a6b4a0 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.13).sql @@ -2,13 +2,13 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13).sql index 42c2d33eee1..89112b1173f 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.13).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13).sql index d42d03de1ee..5a5cbd6f5a4 100644 --- a/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.13).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13).sql index 51bd21b40b0..813bd59c8d8 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.13).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13).sql index 733b279b054..a120e7fa2a8 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.13).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13).sql index 6010dd9282b..ce2da9e00e9 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.13).sql @@ -2,11 +2,11 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13).sql index 1cdea0ec7d1..42a6a7bbaef 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.13).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13).sql index 1cdea0ec7d1..74e4327857a 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.13).sql @@ -2,11 +2,11 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13).sql index 03788533e22..87ca18b1c4f 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.13).sql @@ -2,11 +2,11 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13).sql index 987f7e2547d..7e0d5288f19 100644 --- a/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.13).sql @@ -2,17 +2,21 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.13).sql new file mode 100644 index 00000000000..435b7ea696f --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.13).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.13).sql index a4ac946238a..a8d3bd9af65 100644 --- a/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.13).sql @@ -2,38 +2,28 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN True ELSE False - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) t5 ON 1=1 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.13).sql new file mode 100644 index 00000000000..0cccf8b8fff --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.13).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.13).sql new file mode 100644 index 00000000000..004e151d86e --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.13).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13).sql index 5c7c5cc7155..004e151d86e 100644 --- a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.13).sql @@ -2,17 +2,10 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13).sql index 190ee8790f5..ef8eaad15e9 100644 --- a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.13).sql @@ -2,14 +2,10 @@ -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.13).sql new file mode 100644 index 00000000000..effbe0c30b8 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.13).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.13).sql new file mode 100644 index 00000000000..a2d3a1ff509 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.13).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.13).sql new file mode 100644 index 00000000000..ef8eaad15e9 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.13).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.13).sql new file mode 100644 index 00000000000..b60aba48425 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.13).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.13).sql new file mode 100644 index 00000000000..5c7c5cc7155 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.13).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.13).sql new file mode 100644 index 00000000000..190ee8790f5 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.13).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.13/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.13).sql b/PostgreSQL.13/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.13).sql index a4a2efc5728..1bbf98019fc 100644 --- a/PostgreSQL.13/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.13).sql @@ -78,21 +78,21 @@ FROM SELECT t1."AppSubTypeId", t1."Description", - t1."MAX_1" as "MaxSubtypeCreatedDate", - t1."MAX_2" as "MaxTypeCreatedDate", - t1."MAX_3" as "MaxTypeId", - t1."CountExt" as "CountDistinctTypeId", - t1."CountExt_1" as "CountDistinctSubTypeId" + t1."MaxSubtypeCreatedDate", + t1."MaxTypeCreatedDate", + t1."MaxTypeId", + t1."CountDistinctTypeId", + t1."CountDistinctSubTypeId" FROM ( SELECT - COUNT(DISTINCT type_1."AppTypeId") as "CountExt", - MAX(subtype_1."CreatedDate") as "MAX_1", - MAX(type_1."CreatedDate") as "MAX_2", - MAX(type_1."AppTypeId") as "MAX_3", + COUNT(DISTINCT type_1."AppTypeId") as "CountDistinctTypeId", + MAX(subtype_1."CreatedDate") as "MaxSubtypeCreatedDate", + MAX(type_1."CreatedDate") as "MaxTypeCreatedDate", + MAX(type_1."AppTypeId") as "MaxTypeId", subtype_1."AppSubTypeId", subtype_1."Description", - COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountExt_1" + COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountDistinctSubTypeId" FROM "ItemAppType" grpby LEFT JOIN "AppType" type_1 ON type_1."AppTypeId" = grpby."AppTypeId" @@ -105,10 +105,10 @@ FROM subtype_1."AppSubTypeId" ) t1 ORDER BY - t1."CountExt" DESC, - t1."MAX_1" DESC, - t1."MAX_2" DESC, - t1."MAX_3" DESC + t1."CountDistinctTypeId" DESC, + t1."MaxSubtypeCreatedDate" DESC, + t1."MaxTypeCreatedDate" DESC, + t1."MaxTypeId" DESC LIMIT 1 ) t2 ON 1=1 WHERE diff --git a/PostgreSQL.13/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.13).sql b/PostgreSQL.13/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.13).sql index 52749ccc23a..1a227eff220 100644 --- a/PostgreSQL.13/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.13).sql @@ -122,7 +122,7 @@ BeforeExecute -- PostgreSQL.13 PostgreSQL.9.5 PostgreSQL SELECT - t5."SUM_1", + t5."WithParentReference", t5."WithParentReferenceCustom1", t5."WithParentReferenceCustom2", t5."WithoutParentReference" @@ -153,7 +153,7 @@ FROM WHERE "a_Employee"."EmployeeId" = e."EmployeeId" ) d ON 1=1 - ) as "SUM_1", + ) as "WithParentReference", ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN "Employee" "a_Employee" ON tracking."EmployeeId" = "a_Employee"."EmployeeId" ) t5 ORDER BY - Coalesce(t5."SUM_1", 0), + Coalesce(t5."WithParentReference", 0), Coalesce(t5."WithParentReferenceCustom1", 0), Coalesce(t5."WithParentReferenceCustom2", 0), Coalesce(t5."WithoutParentReference", 0) DESC diff --git a/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13).sql b/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13).sql index 4910a66c88b..0462e9765ad 100644 --- a/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.13).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13).sql b/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13).sql index 67846498aa6..9a7f8ca1660 100644 --- a/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13).sql +++ b/PostgreSQL.13/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.13).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,2).sql b/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,2).sql index 97e3ef1cc0d..f28d368e063 100644 --- a/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,2).sql +++ b/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,2).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 2 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,85).sql b/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,85).sql index 45defcaf806..1443e0c57ab 100644 --- a/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,85).sql +++ b/PostgreSQL.13/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.13,85).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 85 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14.LinqService,False).sql b/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14.LinqService,False).sql index 888b1837dab..b282871bf53 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14.LinqService,False).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14.LinqService).sql index f9a22b5763b..d8ac473c082 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14.LinqService).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14.LinqService).sql index 0836a5395f0..0859d07d0a9 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14.LinqService).sql @@ -288,7 +288,7 @@ BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -296,11 +296,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.14.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14.LinqService).sql index 65207a22f36..80d206e1eb8 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,1).sql b/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,1).sql index f805fca8f4e..940c23a67b5 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,1).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,2).sql b/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,2).sql index 3ec3101dff0..d4bc1df690b 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,2).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14.LinqService).sql index 2fcaf41df99..60b244f8b1d 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,14).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,14).sql index faa8557dbda..4ce84c7f66f 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,14).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,15).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,15).sql index 3daf62baf59..85eb62ebdf6 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,15).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,14).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,14).sql index a10fb35ab79..bc3fa7bbec4 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,14).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,15).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,15).sql index 1ad4aaa5cc3..d749526b22c 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,15).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,14).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,14).sql index abc46ff1427..119fc55cc6f 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,14).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,15).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,15).sql index 735590390c0..6f9afadbda8 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,15).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,14).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,14).sql index 0fb1ab49761..90d60428c95 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,14).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,15).sql b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,15).sql index 9a53a999a0a..2453d8f8f98 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,15).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14.LinqService).sql index c8241ffa07b..24d5b9c8425 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14.LinqService).sql index e3081a6ae30..a9d508e8b11 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14.LinqService).sql index a2172bdeb48..1513b44b725 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14.LinqService).sql index f79dc7da5d6..9fcfd334965 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14.LinqService).sql index ecc3a15f5f5..cc7998ad4c9 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14.LinqService).sql @@ -2,13 +2,13 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14.LinqService).sql index 05b33383f6f..57dbcba136c 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14.LinqService).sql index 954157c06ed..5600b3d3421 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14.LinqService).sql index d51520ba6e4..7881e9e2e7d 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14.LinqService).sql index eab92c68d26..2361684e738 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14.LinqService).sql index 845fbe709bc..19f2933500c 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14.LinqService).sql index 9ecf864267b..a6813d3df5f 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14.LinqService).sql index 9ecf864267b..6d40c722996 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14.LinqService).sql index b150f98b7fb..1b2d70dbb82 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14.LinqService).sql index 71f32976780..ff99f858037 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14.LinqService).sql @@ -2,17 +2,21 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.14.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..e43a07c6059 --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.14.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..1ada035c158 --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.14.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..bb695173d63 --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.14.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14.LinqService).sql index 8365288a03a..bb695173d63 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14.LinqService).sql @@ -2,17 +2,10 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14.LinqService).sql index 1acb75dd1fe..267dd471a40 100644 --- a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14.LinqService).sql @@ -2,14 +2,10 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..af0a29a0883 --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.14.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..786c8f7607f --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.14.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..267dd471a40 --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.14.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..c54a8e82a8a --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.14.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..8365288a03a --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.14.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.14.LinqService).sql new file mode 100644 index 00000000000..1acb75dd1fe --- /dev/null +++ b/PostgreSQL.14.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.14.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14.LinqService).sql index 2896166b6a8..54f48fef533 100644 --- a/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14.LinqService).sql b/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14.LinqService).sql index 49502f26f04..700ffbd42f0 100644 --- a/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14.LinqService).sql +++ b/PostgreSQL.14.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14,False).sql b/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14,False).sql index 61c9f3783c1..26320a4da75 100644 --- a/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14,False).sql +++ b/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.14,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14).sql index f9a22b5763b..d8ac473c082 100644 --- a/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.14).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14).sql index c7169f57016..c307ee7ecbb 100644 --- a/PostgreSQL.14/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.14).sql @@ -73,7 +73,7 @@ BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -81,11 +81,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL diff --git a/PostgreSQL.14/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14).sql index 65207a22f36..80d206e1eb8 100644 --- a/PostgreSQL.14/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.14).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,1).sql b/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,1).sql index f805fca8f4e..940c23a67b5 100644 --- a/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,1).sql +++ b/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,2).sql b/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,2).sql index 3ec3101dff0..d4bc1df690b 100644 --- a/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,2).sql +++ b/PostgreSQL.14/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.14,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.14/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14).sql index 2fcaf41df99..60b244f8b1d 100644 --- a/PostgreSQL.14/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.14).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,14).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,14).sql index 6ca702a226d..f8b31d00948 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,14).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,15).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,15).sql index f1df2051183..a41a4c46917 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,15).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.14,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,14).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,14).sql index 3f6a0888080..d691da93100 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,14).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,15).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,15).sql index fdc7419a219..1199de9fef4 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,15).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.14,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,14).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,14).sql index 84356fc50bb..c6fc57f309f 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,14).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,15).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,15).sql index f45e5ff970f..06ccb155398 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,15).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.14,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,14).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,14).sql index e67897012b7..49441f5e598 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,14).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,15).sql b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,15).sql index ac3c9b465b8..e063c959b5c 100644 --- a/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,15).sql +++ b/PostgreSQL.14/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.14,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14).sql index c8241ffa07b..24d5b9c8425 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.14).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14).sql index e3081a6ae30..a9d508e8b11 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.14).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14).sql index a2172bdeb48..1513b44b725 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.14).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14).sql index f79dc7da5d6..9fcfd334965 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.14).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14).sql index ecc3a15f5f5..cc7998ad4c9 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.14).sql @@ -2,13 +2,13 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14).sql index 05b33383f6f..57dbcba136c 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.14).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14).sql index 954157c06ed..5600b3d3421 100644 --- a/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.14).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14).sql index 9303da10de3..cbc6f857dc2 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.14).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14).sql index 6e659cbf3d0..2eaf14ee0c1 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.14).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14).sql index 845fbe709bc..19f2933500c 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.14).sql @@ -2,11 +2,11 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14).sql index 9ecf864267b..a6813d3df5f 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.14).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14).sql index 9ecf864267b..6d40c722996 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.14).sql @@ -2,11 +2,11 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14).sql index b150f98b7fb..1b2d70dbb82 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.14).sql @@ -2,11 +2,11 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14).sql index 71f32976780..ff99f858037 100644 --- a/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.14).sql @@ -2,17 +2,21 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.14).sql new file mode 100644 index 00000000000..7e2302ea7d3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.14).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.14).sql index 5ff2f171f04..62d80b1aaf1 100644 --- a/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.14).sql @@ -2,38 +2,28 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN True ELSE False - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) t5 ON 1=1 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.14).sql new file mode 100644 index 00000000000..1ada035c158 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.14).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.14).sql new file mode 100644 index 00000000000..bb695173d63 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.14).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14).sql index 8365288a03a..bb695173d63 100644 --- a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.14).sql @@ -2,17 +2,10 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14).sql index 1acb75dd1fe..267dd471a40 100644 --- a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.14).sql @@ -2,14 +2,10 @@ -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.14).sql new file mode 100644 index 00000000000..af0a29a0883 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.14).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.14).sql new file mode 100644 index 00000000000..786c8f7607f --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.14).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.14).sql new file mode 100644 index 00000000000..267dd471a40 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.14).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.14).sql new file mode 100644 index 00000000000..c54a8e82a8a --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.14).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.14).sql new file mode 100644 index 00000000000..8365288a03a --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.14).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.14).sql new file mode 100644 index 00000000000..1acb75dd1fe --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.14).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.14/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.14).sql b/PostgreSQL.14/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.14).sql index abf18e3b9f0..a6d61a284c3 100644 --- a/PostgreSQL.14/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.14).sql @@ -78,21 +78,21 @@ FROM SELECT t1."AppSubTypeId", t1."Description", - t1."MAX_1" as "MaxSubtypeCreatedDate", - t1."MAX_2" as "MaxTypeCreatedDate", - t1."MAX_3" as "MaxTypeId", - t1."CountExt" as "CountDistinctTypeId", - t1."CountExt_1" as "CountDistinctSubTypeId" + t1."MaxSubtypeCreatedDate", + t1."MaxTypeCreatedDate", + t1."MaxTypeId", + t1."CountDistinctTypeId", + t1."CountDistinctSubTypeId" FROM ( SELECT - COUNT(DISTINCT type_1."AppTypeId") as "CountExt", - MAX(subtype_1."CreatedDate") as "MAX_1", - MAX(type_1."CreatedDate") as "MAX_2", - MAX(type_1."AppTypeId") as "MAX_3", + COUNT(DISTINCT type_1."AppTypeId") as "CountDistinctTypeId", + MAX(subtype_1."CreatedDate") as "MaxSubtypeCreatedDate", + MAX(type_1."CreatedDate") as "MaxTypeCreatedDate", + MAX(type_1."AppTypeId") as "MaxTypeId", subtype_1."AppSubTypeId", subtype_1."Description", - COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountExt_1" + COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountDistinctSubTypeId" FROM "ItemAppType" grpby LEFT JOIN "AppType" type_1 ON type_1."AppTypeId" = grpby."AppTypeId" @@ -105,10 +105,10 @@ FROM subtype_1."AppSubTypeId" ) t1 ORDER BY - t1."CountExt" DESC, - t1."MAX_1" DESC, - t1."MAX_2" DESC, - t1."MAX_3" DESC + t1."CountDistinctTypeId" DESC, + t1."MaxSubtypeCreatedDate" DESC, + t1."MaxTypeCreatedDate" DESC, + t1."MaxTypeId" DESC LIMIT 1 ) t2 ON 1=1 WHERE diff --git a/PostgreSQL.14/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.14).sql b/PostgreSQL.14/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.14).sql index a903e6bb50b..777053a7118 100644 --- a/PostgreSQL.14/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.14).sql @@ -122,7 +122,7 @@ BeforeExecute -- PostgreSQL.14 PostgreSQL.9.5 PostgreSQL SELECT - t5."SUM_1", + t5."WithParentReference", t5."WithParentReferenceCustom1", t5."WithParentReferenceCustom2", t5."WithoutParentReference" @@ -153,7 +153,7 @@ FROM WHERE "a_Employee"."EmployeeId" = e."EmployeeId" ) d ON 1=1 - ) as "SUM_1", + ) as "WithParentReference", ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN "Employee" "a_Employee" ON tracking."EmployeeId" = "a_Employee"."EmployeeId" ) t5 ORDER BY - Coalesce(t5."SUM_1", 0), + Coalesce(t5."WithParentReference", 0), Coalesce(t5."WithParentReferenceCustom1", 0), Coalesce(t5."WithParentReferenceCustom2", 0), Coalesce(t5."WithoutParentReference", 0) DESC diff --git a/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14).sql b/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14).sql index 2896166b6a8..54f48fef533 100644 --- a/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.14).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14).sql b/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14).sql index 49502f26f04..700ffbd42f0 100644 --- a/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14).sql +++ b/PostgreSQL.14/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.14).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,2).sql b/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,2).sql index e13faffcc5e..8b482725cf2 100644 --- a/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,2).sql +++ b/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,2).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 2 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,85).sql b/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,85).sql index a0d3d0b8fdd..ee444ff744a 100644 --- a/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,85).sql +++ b/PostgreSQL.14/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.14,85).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 85 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15.LinqService,False).sql b/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15.LinqService,False).sql index 7f9bfe282d5..73adea4d5c4 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15.LinqService,False).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- PostgreSQL.15 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15.LinqService).sql index a1252bf32b0..cd9dbb6e926 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15.LinqService).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15.LinqService).sql index 79c083490c8..bb64e70bb88 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15.LinqService).sql @@ -288,7 +288,7 @@ BeforeExecute -- PostgreSQL.15 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -296,11 +296,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.15.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15.LinqService).sql index b8e121669e8..aff43c91b7c 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,1).sql b/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,1).sql index e5936280dd8..0b53a4a67ca 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,1).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,2).sql b/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,2).sql index 73e3781b01f..72d7c9eeeb5 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,2).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15.LinqService).sql index 1927416a20f..4317b6b08eb 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,14).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,14).sql index 6b4dd1038cf..8b4075e08dc 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,14).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,15).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,15).sql index 0396c4f43f2..96408e26d19 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,15).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,14).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,14).sql index 31a9ac39e25..6117e4f9b3e 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,14).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,15).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,15).sql index 64b1aa70b85..5228c6f895d 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,15).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,14).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,14).sql index 483c69f5f1d..8e9452ca9f8 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,14).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,15).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,15).sql index ecb7f1c1b0b..1076c8eb2fa 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,15).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,14).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,14).sql index 7ad19aa8d73..4cf0c6218d0 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,14).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,15).sql b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,15).sql index 8e600e00c24..7c2d441c978 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,15).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15.LinqService).sql index 8e4a329e8d6..e27e3866c2d 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15.LinqService).sql index 4d3372612ce..7e0ca0c6e89 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15.LinqService).sql index 231ff50455e..3e8d46ccd4d 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15.LinqService).sql index f9d4dfa1f09..1c50b70ec3e 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15.LinqService).sql index ef4a95cfaac..d88b199d664 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15.LinqService).sql @@ -2,13 +2,13 @@ -- PostgreSQL.15 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15.LinqService).sql index a4c661ea648..e413a4aadda 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15.LinqService).sql index b991f6fb31d..1fba4839061 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15.LinqService).sql index 841140d6125..cb9aa08c955 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15.LinqService).sql index 138a33ba1a5..cbc5f3160c6 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15.LinqService).sql index bf242a848a6..d3d151d584b 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15.LinqService).sql index bec2ab021ca..17b5319b378 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15.LinqService).sql index bec2ab021ca..80c2c997e90 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15.LinqService).sql index 1752cd357c6..bd39702ecfb 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15.LinqService).sql index e9713b27739..de9c686ed48 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15.LinqService).sql @@ -2,17 +2,21 @@ -- PostgreSQL.15 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.15.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..a64eaf7e358 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.15.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..ac6953d53b8 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.15.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..6d61be1ea3f --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.15.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15.LinqService).sql index 8638be32871..6d61be1ea3f 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15.LinqService).sql @@ -2,17 +2,10 @@ -- PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15.LinqService).sql index bf464f9e02d..6d432469764 100644 --- a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15.LinqService).sql @@ -2,14 +2,10 @@ -- PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..8b936aa8d08 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.15.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..f1dea50c980 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.15.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..6d432469764 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.15.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..c4efa424179 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.15.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..8638be32871 --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.15.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.15.LinqService).sql new file mode 100644 index 00000000000..bf464f9e02d --- /dev/null +++ b/PostgreSQL.15.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.15.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15.LinqService).sql index 3f90161274b..c5e1bfdac5d 100644 --- a/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15.LinqService).sql b/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15.LinqService).sql index eb9ccae2e35..dce41d2862c 100644 --- a/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15.LinqService).sql +++ b/PostgreSQL.15.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15,False).sql b/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15,False).sql index 67ca30aaf81..808c9023e22 100644 --- a/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15,False).sql +++ b/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.15,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- PostgreSQL.15 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15).sql index a1252bf32b0..cd9dbb6e926 100644 --- a/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.15).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15).sql index ed6bb4b249a..2f64143fe63 100644 --- a/PostgreSQL.15/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.15).sql @@ -73,7 +73,7 @@ BeforeExecute -- PostgreSQL.15 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -81,11 +81,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.15/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15).sql index b8e121669e8..aff43c91b7c 100644 --- a/PostgreSQL.15/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.15).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,1).sql b/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,1).sql index e5936280dd8..0b53a4a67ca 100644 --- a/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,1).sql +++ b/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,2).sql b/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,2).sql index 73e3781b01f..72d7c9eeeb5 100644 --- a/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,2).sql +++ b/PostgreSQL.15/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.15,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.15/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15).sql index 1927416a20f..4317b6b08eb 100644 --- a/PostgreSQL.15/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.15).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,14).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,14).sql index 80239878759..6eee31a7e18 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,14).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,15).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,15).sql index 374516fe95e..f19d32642ac 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,15).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.15,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,14).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,14).sql index 25a4ec075e9..de32296bc3e 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,14).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,15).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,15).sql index f0ee92486df..82e23a3a6a2 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,15).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.15,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,14).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,14).sql index 748c713b8b5..c59ba1a7cc7 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,14).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,15).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,15).sql index cdc9aba8707..8d3b9bb4721 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,15).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.15,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,14).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,14).sql index 1a6ae8b7dbe..737772d05b2 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,14).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,15).sql b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,15).sql index 204626c4668..4fda29e0f5b 100644 --- a/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,15).sql +++ b/PostgreSQL.15/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.15,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15).sql index 8e4a329e8d6..e27e3866c2d 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.15).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15).sql index 4d3372612ce..7e0ca0c6e89 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.15).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15).sql index 231ff50455e..3e8d46ccd4d 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.15).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15).sql index f9d4dfa1f09..1c50b70ec3e 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.15).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15).sql index ef4a95cfaac..d88b199d664 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.15).sql @@ -2,13 +2,13 @@ -- PostgreSQL.15 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15).sql index a4c661ea648..e413a4aadda 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.15).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15).sql index b991f6fb31d..1fba4839061 100644 --- a/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.15).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15).sql index 69266c387bc..86b60c355d0 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.15).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15).sql index f451e9e5cb3..f62d31596f8 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.15).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15).sql index bf242a848a6..d3d151d584b 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.15).sql @@ -2,11 +2,11 @@ -- PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15).sql index bec2ab021ca..17b5319b378 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.15).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15).sql index bec2ab021ca..80c2c997e90 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.15).sql @@ -2,11 +2,11 @@ -- PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15).sql index 1752cd357c6..bd39702ecfb 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.15).sql @@ -2,11 +2,11 @@ -- PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15).sql index e9713b27739..de9c686ed48 100644 --- a/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.15).sql @@ -2,17 +2,21 @@ -- PostgreSQL.15 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.15).sql new file mode 100644 index 00000000000..042f1b32fdd --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.15).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.15).sql index 0bae679ee1c..ab0f28a872e 100644 --- a/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.15).sql @@ -2,38 +2,28 @@ -- PostgreSQL.15 PostgreSQL SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN True ELSE False - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) t5 ON 1=1 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.15).sql new file mode 100644 index 00000000000..ac6953d53b8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.15).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.15).sql new file mode 100644 index 00000000000..6d61be1ea3f --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.15).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15).sql index 8638be32871..6d61be1ea3f 100644 --- a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.15).sql @@ -2,17 +2,10 @@ -- PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15).sql index bf464f9e02d..6d432469764 100644 --- a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.15).sql @@ -2,14 +2,10 @@ -- PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.15).sql new file mode 100644 index 00000000000..8b936aa8d08 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.15).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.15).sql new file mode 100644 index 00000000000..f1dea50c980 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.15).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.15).sql new file mode 100644 index 00000000000..6d432469764 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.15).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.15).sql new file mode 100644 index 00000000000..c4efa424179 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.15).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.15).sql new file mode 100644 index 00000000000..8638be32871 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.15).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.15).sql new file mode 100644 index 00000000000..bf464f9e02d --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.15).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.15/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.15).sql b/PostgreSQL.15/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.15).sql index d06640f10a9..090fa7f07e2 100644 --- a/PostgreSQL.15/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.15).sql @@ -78,21 +78,21 @@ FROM SELECT t1."AppSubTypeId", t1."Description", - t1."MAX_1" as "MaxSubtypeCreatedDate", - t1."MAX_2" as "MaxTypeCreatedDate", - t1."MAX_3" as "MaxTypeId", - t1."CountExt" as "CountDistinctTypeId", - t1."CountExt_1" as "CountDistinctSubTypeId" + t1."MaxSubtypeCreatedDate", + t1."MaxTypeCreatedDate", + t1."MaxTypeId", + t1."CountDistinctTypeId", + t1."CountDistinctSubTypeId" FROM ( SELECT - COUNT(DISTINCT type_1."AppTypeId") as "CountExt", - MAX(subtype_1."CreatedDate") as "MAX_1", - MAX(type_1."CreatedDate") as "MAX_2", - MAX(type_1."AppTypeId") as "MAX_3", + COUNT(DISTINCT type_1."AppTypeId") as "CountDistinctTypeId", + MAX(subtype_1."CreatedDate") as "MaxSubtypeCreatedDate", + MAX(type_1."CreatedDate") as "MaxTypeCreatedDate", + MAX(type_1."AppTypeId") as "MaxTypeId", subtype_1."AppSubTypeId", subtype_1."Description", - COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountExt_1" + COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountDistinctSubTypeId" FROM "ItemAppType" grpby LEFT JOIN "AppType" type_1 ON type_1."AppTypeId" = grpby."AppTypeId" @@ -105,10 +105,10 @@ FROM subtype_1."AppSubTypeId" ) t1 ORDER BY - t1."CountExt" DESC, - t1."MAX_1" DESC, - t1."MAX_2" DESC, - t1."MAX_3" DESC + t1."CountDistinctTypeId" DESC, + t1."MaxSubtypeCreatedDate" DESC, + t1."MaxTypeCreatedDate" DESC, + t1."MaxTypeId" DESC LIMIT 1 ) t2 ON 1=1 WHERE diff --git a/PostgreSQL.15/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.15).sql b/PostgreSQL.15/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.15).sql index 52508ac75d5..c07757e58b8 100644 --- a/PostgreSQL.15/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.15).sql @@ -122,7 +122,7 @@ BeforeExecute -- PostgreSQL.15 PostgreSQL SELECT - t5."SUM_1", + t5."WithParentReference", t5."WithParentReferenceCustom1", t5."WithParentReferenceCustom2", t5."WithoutParentReference" @@ -153,7 +153,7 @@ FROM WHERE "a_Employee"."EmployeeId" = e."EmployeeId" ) d ON 1=1 - ) as "SUM_1", + ) as "WithParentReference", ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN "Employee" "a_Employee" ON tracking."EmployeeId" = "a_Employee"."EmployeeId" ) t5 ORDER BY - Coalesce(t5."SUM_1", 0), + Coalesce(t5."WithParentReference", 0), Coalesce(t5."WithParentReferenceCustom1", 0), Coalesce(t5."WithParentReferenceCustom2", 0), Coalesce(t5."WithoutParentReference", 0) DESC diff --git a/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15).sql b/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15).sql index 3f90161274b..c5e1bfdac5d 100644 --- a/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.15).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15).sql b/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15).sql index eb9ccae2e35..dce41d2862c 100644 --- a/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15).sql +++ b/PostgreSQL.15/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.15).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,2).sql b/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,2).sql index 82464c913d4..fdffecbd46e 100644 --- a/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,2).sql +++ b/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,2).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 2 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,85).sql b/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,85).sql index 08ae53bf70c..94879db8ad9 100644 --- a/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,85).sql +++ b/PostgreSQL.15/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.15,85).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 85 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16.LinqService,False).sql b/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16.LinqService,False).sql index 049b0c5bafa..bc04809a36e 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16.LinqService,False).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16.LinqService).sql index 2716350c1b2..d0ace1cfd9b 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16.LinqService).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16.LinqService).sql index 250aa3f81b8..6bdc94c0910 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16.LinqService).sql @@ -288,7 +288,7 @@ BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -296,11 +296,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.16.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16.LinqService).sql index c2337b0c7d0..ab9e2ca05c3 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,1).sql b/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,1).sql index 2a7c801e540..b2a7b5c9ff2 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,1).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,2).sql b/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,2).sql index 6e9a449100b..1a44e4578b6 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,2).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16.LinqService).sql index e7402825a39..64aefea4ca8 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,14).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,14).sql index aaa116a8137..fe982e46f20 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,14).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,15).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,15).sql index efe2b0945e9..af6448a37ca 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,15).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,14).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,14).sql index 6e84cf66206..d2025f97799 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,14).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,15).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,15).sql index f64e18cb04d..d3f17fca462 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,15).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,14).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,14).sql index 5adbddfd38d..efd760faca8 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,14).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,15).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,15).sql index 438cd45f43e..567e3054ca9 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,15).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,14).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,14).sql index aadc320c29d..e551632e5ca 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,14).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,15).sql b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,15).sql index 88845c04af2..b922b31ab3f 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,15).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16.LinqService).sql index 46c42a3ed7b..828211c91fe 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16.LinqService).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16.LinqService).sql index 704cd33c567..957857223f3 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16.LinqService).sql index 39ed826a321..edfb527a40c 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16.LinqService).sql index 7e14298cd43..820af2a0e36 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16.LinqService).sql index 15be8d798b2..b231bb5bd9d 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16.LinqService).sql @@ -2,13 +2,13 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16.LinqService).sql index c6a6deceb04..c777b7d0dae 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16.LinqService).sql index cbd81a2d3c9..7cf349384bf 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16.LinqService).sql index fd7fd898aa1..319ef956d49 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16.LinqService).sql index 82ada2284d7..c5e4915592c 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16.LinqService).sql index cd986379456..3245a80eac0 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16.LinqService).sql index 265c64df732..f4b19d10465 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16.LinqService).sql index 265c64df732..d91aa27fdf3 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16.LinqService).sql index 32b5aeadfac..627082cd0d9 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16.LinqService).sql @@ -2,11 +2,11 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16.LinqService).sql index 3ebf9c3bfbc..8528c314fa1 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16.LinqService).sql @@ -2,17 +2,21 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.16.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..7ec6bdf1b0d --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.16.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + :Id, + :Nullable1, + :Nullable2, + :Nullable3 +) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..46ec259eb2f --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.16.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..078f26c5112 --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.16.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16.LinqService).sql index 90fbdb9e066..078f26c5112 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16.LinqService).sql @@ -2,17 +2,10 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16.LinqService).sql index 1b397c2df39..833fc0522d8 100644 --- a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16.LinqService).sql @@ -2,14 +2,10 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..abe3b173604 --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.16.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..aa6b33a784a --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.16.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..833fc0522d8 --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.16.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..2e2bcd438cf --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.16.LinqService).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..90fbdb9e066 --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.16.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.16.LinqService).sql new file mode 100644 index 00000000000..1b397c2df39 --- /dev/null +++ b/PostgreSQL.16.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.16.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16.LinqService).sql index 8a58f0d8d64..215024737ca 100644 --- a/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16.LinqService).sql b/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16.LinqService).sql index 164ab98f2b4..20c2610bafa 100644 --- a/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16.LinqService).sql +++ b/PostgreSQL.16.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16,False).sql b/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16,False).sql index 25964c87458..da0437b7a1a 100644 --- a/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16,False).sql +++ b/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(PostgreSQL.16,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" FROM - "Issue4167Table" g_1 -WHERE - g_1."Value" = '000001' -GROUP BY - g_1."Value", - g_1."EnumValue" + ( + SELECT + CASE + WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" + ELSE 0 + END as "EnumValue" + FROM + "Issue4167Table" g_1 + WHERE + g_1."Value" = '000001' + GROUP BY + g_1."Value", + g_1."EnumValue" + ) t1 ORDER BY - CASE - WHEN g_1."EnumValue" IS NOT NULL THEN g_1."EnumValue" - ELSE 0 - END + t1."EnumValue" BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16).sql index 2716350c1b2..d0ace1cfd9b 100644 --- a/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(PostgreSQL.16).sql @@ -67,10 +67,10 @@ SELECT c4."ChildID", c4."ParentID" FROM - "Child" p - INNER JOIN "Child" c4 ON c4."ParentID" = p."ParentID" + "Child" c_1 + INNER JOIN "Child" c4 ON c4."ParentID" = c_1."ParentID" WHERE - p."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 + c_1."ParentID" > 1 AND (c4."ParentID"::decimal % 2)::decimal = 0 ORDER BY c4."ChildID", c4."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16).sql index 56af7ee5549..bb7da785ee5 100644 --- a/PostgreSQL.16/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(PostgreSQL.16).sql @@ -73,7 +73,7 @@ BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x_1."Date_1", + t1."Date_1", COUNT(*) FROM ( @@ -81,11 +81,11 @@ FROM Date_Trunc('day', x."TransactionDate" AT TIME ZONE 'UTC')::Date as "Date_1" FROM "Transactions" x - ) x_1 + ) t1 GROUP BY - x_1."Date_1" + t1."Date_1" ORDER BY - x_1."Date_1" + t1."Date_1" BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL diff --git a/PostgreSQL.16/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16).sql index c2337b0c7d0..ab9e2ca05c3 100644 --- a/PostgreSQL.16/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(PostgreSQL.16).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,1).sql b/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,1).sql index 2a7c801e540..b2a7b5c9ff2 100644 --- a/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,1).sql +++ b/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,1).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,2).sql b/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,2).sql index 6e9a449100b..1a44e4578b6 100644 --- a/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,2).sql +++ b/PostgreSQL.16/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(PostgreSQL.16,2).sql @@ -9,10 +9,10 @@ SELECT n."FirstName", n."PersonID" FROM - "Person" p + "Person" t1 INNER JOIN (VALUES ('Janet',:ID), ('Doe',:ID_1) - ) n("FirstName", "PersonID") ON p."PersonID" = n."PersonID" + ) n("FirstName", "PersonID") ON t1."PersonID" = n."PersonID" ORDER BY n."PersonID" diff --git a/PostgreSQL.16/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16).sql index e7402825a39..64aefea4ca8 100644 --- a/PostgreSQL.16/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(PostgreSQL.16).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT t1."Id", t1."FirstName", - t1."LastName", - t1."FirstName" || ' ' || t1."LastName" + t1."LastName" FROM "Issue2434Table" t1 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,14).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,14).sql index 5b4720e7cd8..eccbd6cba7b 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,14).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,15).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,15).sql index 5c47b9c8ab7..bd4b5e6a8bc 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,15).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(PostgreSQL.16,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,14).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,14).sql index 1620e7f58c0..5e8951adfc2 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,14).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,15).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,15).sql index 37db3696115..cfbd35a196c 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,15).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(PostgreSQL.16,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,14).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,14).sql index bd0fc734e52..be35e7a390e 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,14).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,15).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,15).sql index fb90c2bd2aa..5a7465b03dc 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,15).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(PostgreSQL.16,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :endId - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,14).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,14).sql index 38266babe3f..f3cb734f87c 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,14).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,14).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,15).sql b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,15).sql index f11f437892c..f2b97fdab68 100644 --- a/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,15).sql +++ b/PostgreSQL.16/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(PostgreSQL.16,15).sql @@ -53,10 +53,10 @@ SELECT s.value, s.id FROM - sample_class c_1 + sample_class t1 INNER JOIN ( SELECT * FROM sample_class where id >= :startId and id < :p - ) s ON s.id = c_1.id + ) s ON s.id = t1.id WHERE s.id > 10 ORDER BY diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16).sql index 46c42a3ed7b..828211c91fe 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(PostgreSQL.16).sql @@ -4,8 +4,8 @@ SELECT a_2."ParentID", a_2."Value1", - z_1."ParentID", - z_1."Value1", + z_2."ParentID", + z_2."Value1", y."ParentID", y."Value1", a."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" y ON a_2."ParentID" = y."ParentID" LEFT JOIN "Parent" a ON a_2."ParentID" = a."ParentID" LEFT JOIN "Parent" z ON a_2."ParentID" = z."ParentID" - LEFT JOIN "Parent" z_1 ON a_2."ParentID" = Coalesce(z_1."Value1", 1) + LEFT JOIN ( + SELECT + z_1."ParentID", + z_1."Value1", + Coalesce(z_1."Value1", 1) as c1 + FROM + "Parent" z_1 + ) z_2 ON a_2."ParentID" = z_2.c1 LEFT JOIN "Parent" a_1 ON a_2."ParentID" = a_1."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16).sql index 704cd33c567..957857223f3 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(PostgreSQL.16).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) right_2 ON right_2."ParentID" = left_1."ParentID" + ) right_2 ON right_2."ParentID" = t1."ParentID" ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16).sql index 39ed826a321..edfb527a40c 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(PostgreSQL.16).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_2.left_1, + t2.left_1, t1."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" left_1 WHERE left_1."ParentID" <> :id1 - ) left_2 + ) t2 FULL JOIN ( SELECT right_1."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id2 - ) t1 ON t1."ParentID" = left_2.left_1 + ) t1 ON t1."ParentID" = t2.left_1 ORDER BY - left_2.left_1 + t2.left_1 diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16).sql index 7e14298cd43..820af2a0e36 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(PostgreSQL.16).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - left_1."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -17,7 +17,7 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 WHERE right_1."ParentID" <> :id2 AND right2."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_1."Value1" OR right_2.c1 IS NULL AND left_1."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16).sql index 15be8d798b2..b231bb5bd9d 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(PostgreSQL.16).sql @@ -2,13 +2,13 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM - "Parent" left_1 + "Parent" t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16).sql index c6a6deceb04..c777b7d0dae 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(PostgreSQL.16).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_1."ParentID", + t1."ParentID", right_1."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" p WHERE p."ParentID" <> :id1 - ) left_1 + ) t1 RIGHT JOIN "Parent" right_1 INNER JOIN "Parent" right2 ON right_1."Value1" = right2."Value1" + 2 - ON (right_1."Value1" + 2 = left_1."Value1" OR right_1."Value1" IS NULL AND left_1."Value1" IS NULL) + ON (right_1."Value1" + 2 = t1."Value1" OR right_1."Value1" IS NULL AND t1."Value1" IS NULL) ORDER BY - left_1."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16).sql index cbd81a2d3c9..7cf349384bf 100644 --- a/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(PostgreSQL.16).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - left_2."ParentID", + t1."ParentID", right_2."ParentID" FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN "Parent" left2 ON left_1."Value1" = left2."Value1" + 2 WHERE left_1."ParentID" <> :id2 AND left2."ParentID" <> :id1 - ) left_2 + ) t1 RIGHT JOIN ( SELECT right_1."ParentID", @@ -27,7 +27,7 @@ FROM "Parent" right_1 WHERE right_1."ParentID" <> :id1 - ) right_2 ON (right_2.c1 = left_2."Value1" OR right_2.c1 IS NULL AND left_2."Value1" IS NULL) + ) right_2 ON (right_2.c1 = t1."Value1" OR right_2.c1 IS NULL AND t1."Value1" IS NULL) ORDER BY - left_2."ParentID" + t1."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16).sql index f78c08c88bd..94a349c514e 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(PostgreSQL.16).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX(g_1."OrderData1") + MAX(x."OrderData1") LIMIT :take OFFSET :skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MIN(g_1."OrderData1") DESC + MIN(x."OrderData1") DESC LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16).sql index aff90c23656..da1b7e6fb82 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(PostgreSQL.16).sql @@ -67,13 +67,13 @@ DECLARE @skip Integer -- Int32 SET @skip = 0 SELECT - g_1."DuplicateData" + x."DuplicateData" FROM - "OrderByDistinctData" g_1 + "OrderByDistinctData" x GROUP BY - g_1."DuplicateData" + x."DuplicateData" ORDER BY - MAX((g_1."OrderData1"::decimal % 3)::decimal) + MAX((x."OrderData1"::decimal % 3)::decimal) LIMIT :take OFFSET :skip BeforeExecute diff --git a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16).sql index cd986379456..3245a80eac0 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(PostgreSQL.16).sql @@ -2,11 +2,11 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" DESC diff --git a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16).sql index 265c64df732..f4b19d10465 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(PostgreSQL.16).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" x ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + x."ChildID", + (x."ChildID"::decimal % 2)::decimal diff --git a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16).sql index 265c64df732..d91aa27fdf3 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(PostgreSQL.16).sql @@ -2,11 +2,11 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal, - x."ChildID" + (ch."ChildID"::decimal % 2)::decimal, + ch."ChildID" diff --git a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16).sql index 32b5aeadfac..627082cd0d9 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(PostgreSQL.16).sql @@ -2,11 +2,11 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - x."ParentID", - x."ChildID" + ch."ParentID", + ch."ChildID" FROM - "Child" x + "Child" ch ORDER BY - (x."ChildID"::decimal % 2)::decimal DESC, - x."ChildID" DESC + (ch."ChildID"::decimal % 2)::decimal DESC, + ch."ChildID" DESC diff --git a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16).sql index 3ebf9c3bfbc..8528c314fa1 100644 --- a/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(PostgreSQL.16).sql @@ -2,17 +2,21 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - t1."PersonID", - t1."LastName", - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2."ID", + t2."LastName", + t2.flag FROM - "Person" t1 + ( + SELECT + CASE + WHEN t1."PersonID" IN (1, 3) THEN True + ELSE False + END as flag, + t1."PersonID" as "ID", + t1."LastName" + FROM + "Person" t1 + ) t2 ORDER BY - CASE - WHEN t1."PersonID" IN (1, 3) THEN True - ELSE False - END + t2.flag diff --git a/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.16).sql new file mode 100644 index 00000000000..cde9ff842c7 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(PostgreSQL.16).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +CREATE TABLE IF NOT EXISTS "CoalesceNullableFields" +( + "Id" Int NOT NULL, + "Nullable1" Int NULL, + "Nullable2" Int NULL, + "Nullable3" Int NULL, + + CONSTRAINT "PK_CoalesceNullableFields" PRIMARY KEY ("Id") +) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + Coalesce(t."Nullable1", t."Nullable2", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable1", t."Nullable3", t."Id"), + Coalesce(t."Nullable2", t."Nullable3", t."Nullable1", t."Id"), + Coalesce(t."Nullable3", t."Nullable1", t."Nullable2", t."Id"), + Coalesce(t."Nullable3", t."Nullable2", t."Nullable1", t."Id"), + t."Id", + Coalesce(t."Nullable1", t."Id"), + Coalesce(t."Nullable1", t."Nullable2", t."Id") +FROM + "CoalesceNullableFields" t + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t1."Id", + t1."Nullable1", + t1."Nullable2", + t1."Nullable3" +FROM + "CoalesceNullableFields" t1 + +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +DROP TABLE IF EXISTS "CoalesceNullableFields" + diff --git a/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.16).sql index 9bc114ae0e8..22850794e13 100644 --- a/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(PostgreSQL.16).sql @@ -2,38 +2,28 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - t6."ParentID_6", - t6."Value1", t6."ParentID", + t6."Value1", + t6."ParentID_1", t6."ChildID", t6."Any_1", t6."ChildID_1", - t6."ParentID_1", - t6."ChildID_2", t6."ParentID_2", - t6."ChildID_3", + t6."ChildID_2", t6."ParentID_3", - t6."ChildID_4", + t6."ChildID_3", t6."ParentID_4", + t6."ChildID_4", + t6."ParentID_5", t6."ChildID_5", - t6."ParentID_5" + t6."ParentID_6" FROM ( SELECT DISTINCT - c1_1."ParentID", - c1_1."ChildID", - t1."ChildID" as "ChildID_1", - t1."ParentID" as "ParentID_1", - t2."ChildID" as "ChildID_2", - t2."ParentID" as "ParentID_2", - t3."ChildID" as "ChildID_3", - t3."ParentID" as "ParentID_3", - t4."ChildID" as "ChildID_4", - t4."ParentID" as "ParentID_4", - t5."ChildID" as "ChildID_5", - t5."ParentID" as "ParentID_5", - p."ParentID" as "ParentID_6", + p."ParentID", p."Value1", + c1_1."ParentID" as "ParentID_1", + c1_1."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN True ELSE False - END as "Any_1" + END as "Any_1", + t1."ChildID" as "ChildID_1", + t1."ParentID" as "ParentID_2", + t2."ChildID" as "ChildID_2", + t2."ParentID" as "ParentID_3", + t3."ChildID" as "ChildID_3", + t3."ParentID" as "ParentID_4", + t4."ChildID" as "ChildID_4", + t4."ParentID" as "ParentID_5", + t5."ChildID" as "ChildID_5", + t5."ParentID" as "ParentID_6" FROM "Parent" p LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) t5 ON 1=1 ) t6 ORDER BY - t6."ParentID_6" + t6."ParentID" diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.16).sql new file mode 100644 index 00000000000..46ec259eb2f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(PostgreSQL.16).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND Coalesce(p."MiddleName", 'None') = 'None' AND + p."FirstName" = 'John' + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.16).sql new file mode 100644 index 00000000000..078f26c5112 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(PostgreSQL.16).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" = 1 + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16).sql index 90fbdb9e066..078f26c5112 100644 --- a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(PostgreSQL.16).sql @@ -2,17 +2,10 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND - p."MiddleName" IS NULL AND - p."MiddleName" IS NULL AND - p."FirstName" IS NOT NULL AND - p."FirstName" IS NOT NULL + p."ParentID" = 1 diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16).sql index 1b397c2df39..833fc0522d8 100644 --- a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(PostgreSQL.16).sql @@ -2,14 +2,10 @@ -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - p."FirstName", - p."PersonID", - p."LastName", - p."MiddleName", - p."Gender" + p."ParentID", + p."Value1" FROM - "Person" p + "Parent" p WHERE - p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND - NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + p."ParentID" <> 1 diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.16).sql new file mode 100644 index 00000000000..abe3b173604 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(PostgreSQL.16).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."Value1" = 1 + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.16).sql new file mode 100644 index 00000000000..aa6b33a784a --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(PostgreSQL.16).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + (p."Value1" <> 1 OR p."Value1" IS NULL) + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.16).sql new file mode 100644 index 00000000000..833fc0522d8 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(PostgreSQL.16).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."ParentID", + p."Value1" +FROM + "Parent" p +WHERE + p."ParentID" <> 1 + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.16).sql new file mode 100644 index 00000000000..2e2bcd438cf --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(PostgreSQL.16).sql @@ -0,0 +1,14 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND p."MiddleName" IS NULL AND p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.16).sql new file mode 100644 index 00000000000..90fbdb9e066 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(PostgreSQL.16).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND + p."MiddleName" IS NULL AND + p."MiddleName" IS NULL AND + p."FirstName" IS NOT NULL AND + p."FirstName" IS NOT NULL + diff --git a/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.16).sql new file mode 100644 index 00000000000..1b397c2df39 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(PostgreSQL.16).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + p."FirstName", + p."PersonID", + p."LastName", + p."MiddleName", + p."Gender" +FROM + "Person" p +WHERE + p."PersonID" = 1 AND NOT (p."MiddleName" IS NOT NULL OR p."PersonID" = 2 OR p."MiddleName" IS NOT NULL) AND + NOT (p."FirstName" IS NULL OR p."PersonID" = 2 OR p."FirstName" IS NULL) + diff --git a/PostgreSQL.16/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.16).sql b/PostgreSQL.16/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.16).sql index 45071e36713..47532e02763 100644 --- a/PostgreSQL.16/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(PostgreSQL.16).sql @@ -78,21 +78,21 @@ FROM SELECT t1."AppSubTypeId", t1."Description", - t1."MAX_1" as "MaxSubtypeCreatedDate", - t1."MAX_2" as "MaxTypeCreatedDate", - t1."MAX_3" as "MaxTypeId", - t1."CountExt" as "CountDistinctTypeId", - t1."CountExt_1" as "CountDistinctSubTypeId" + t1."MaxSubtypeCreatedDate", + t1."MaxTypeCreatedDate", + t1."MaxTypeId", + t1."CountDistinctTypeId", + t1."CountDistinctSubTypeId" FROM ( SELECT - COUNT(DISTINCT type_1."AppTypeId") as "CountExt", - MAX(subtype_1."CreatedDate") as "MAX_1", - MAX(type_1."CreatedDate") as "MAX_2", - MAX(type_1."AppTypeId") as "MAX_3", + COUNT(DISTINCT type_1."AppTypeId") as "CountDistinctTypeId", + MAX(subtype_1."CreatedDate") as "MaxSubtypeCreatedDate", + MAX(type_1."CreatedDate") as "MaxTypeCreatedDate", + MAX(type_1."AppTypeId") as "MaxTypeId", subtype_1."AppSubTypeId", subtype_1."Description", - COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountExt_1" + COUNT(DISTINCT subtype_1."AppSubTypeId") as "CountDistinctSubTypeId" FROM "ItemAppType" grpby LEFT JOIN "AppType" type_1 ON type_1."AppTypeId" = grpby."AppTypeId" @@ -105,10 +105,10 @@ FROM subtype_1."AppSubTypeId" ) t1 ORDER BY - t1."CountExt" DESC, - t1."MAX_1" DESC, - t1."MAX_2" DESC, - t1."MAX_3" DESC + t1."CountDistinctTypeId" DESC, + t1."MaxSubtypeCreatedDate" DESC, + t1."MaxTypeCreatedDate" DESC, + t1."MaxTypeId" DESC LIMIT 1 ) t2 ON 1=1 WHERE diff --git a/PostgreSQL.16/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.16).sql b/PostgreSQL.16/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.16).sql index 1935b80de16..d0b98c84545 100644 --- a/PostgreSQL.16/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(PostgreSQL.16).sql @@ -122,7 +122,7 @@ BeforeExecute -- PostgreSQL.16 PostgreSQL.15 PostgreSQL SELECT - t5."SUM_1", + t5."WithParentReference", t5."WithParentReferenceCustom1", t5."WithParentReferenceCustom2", t5."WithoutParentReference" @@ -153,7 +153,7 @@ FROM WHERE "a_Employee"."EmployeeId" = e."EmployeeId" ) d ON 1=1 - ) as "SUM_1", + ) as "WithParentReference", ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN "Employee" "a_Employee" ON tracking."EmployeeId" = "a_Employee"."EmployeeId" ) t5 ORDER BY - Coalesce(t5."SUM_1", 0), + Coalesce(t5."WithParentReference", 0), Coalesce(t5."WithParentReferenceCustom1", 0), Coalesce(t5."WithParentReferenceCustom2", 0), Coalesce(t5."WithoutParentReference", 0) DESC diff --git a/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16).sql b/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16).sql index 8a58f0d8d64..215024737ca 100644 --- a/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(PostgreSQL.16).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16).sql b/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16).sql index 164ab98f2b4..20c2610bafa 100644 --- a/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16).sql +++ b/PostgreSQL.16/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(PostgreSQL.16).sql @@ -4,10 +4,10 @@ DECLARE @take Integer -- Int32 SET @take = 10 SELECT - x."ParentID", + t3."ParentID", t2."ChildID" FROM - "Parent" x + "Parent" t3 INNER JOIN ( SELECT c_2."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY c_2."ParentID" LIMIT 10 OFFSET 10 - ) t2 ON t2."ParentID" = x."ParentID" + ) t2 ON t2."ParentID" = t3."ParentID" ORDER BY - x."ParentID" + t3."ParentID" LIMIT :take diff --git a/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,2).sql b/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,2).sql index 29038c56f05..7f8409b2e2e 100644 --- a/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,2).sql +++ b/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,2).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 2 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,85).sql b/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,85).sql index 83b85fdae7f..9bd4abae7f1 100644 --- a/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,85).sql +++ b/PostgreSQL.16/Tests/UserTests/Issue3636Tests/Tests.UserTests.Issue3636Tests.CheckCacheIssue(PostgreSQL.16,85).sql @@ -62,7 +62,7 @@ DECLARE @myId Integer -- Int32 SET @myId = 85 SELECT - m_1."ID", + m_1."Key_1", d.id, d.id2, d.id3, @@ -71,7 +71,7 @@ SELECT FROM ( SELECT - x.id as "ID" + x.id as "Key_1" FROM "T1" x LEFT JOIN "T2" order_1 ON x.id = order_1.id AND order_1.id2 = :myId @@ -83,7 +83,7 @@ FROM x.id LIMIT 1 ) m_1 - INNER JOIN "T1" d ON m_1."ID" = d.id + INNER JOIN "T1" d ON m_1."Key_1" = d.id LEFT JOIN "T2" order_2 ON d.id = order_2.id AND order_2.id2 = :myId WHERE d.id2 = :myId diff --git a/SQLite.Classic.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.LinqService).sql index cf2c66186b5..b91bd02da7a 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.LinqService).sql @@ -2,14 +2,14 @@ -- SQLite.Classic SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.LinqService).sql index 714aff53066..4b3671806ea 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.LinqService,False).sql b/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.LinqService,False).sql index 7db28980232..2d8cb6a1f59 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.LinqService,False).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- SQLite.Classic SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.Classic SQLite diff --git a/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.LinqService).sql index 2dd31d180d3..22ec2e9d76c 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.LinqService).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.LinqService).sql index d6860a5dfb8..86f0368c881 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,1).sql b/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,1).sql index 94b61070f7d..6a28a924264 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,1).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,2).sql b/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,2).sql index dfcbba4fe7b..906183b0a8d 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,2).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.LinqService,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.LinqService).sql index 607785970db..5578bdcd2d7 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,14).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,14).sql index e8afa524538..1d06241d303 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,14).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,15).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,15).sql index cbc45d7ec96..5489b426603 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,15).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,14).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,14).sql index 14b7c129ff1..e3451a63417 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,14).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,15).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,15).sql index 60e9c1cae68..83c5b3d95f7 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,15).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,14).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,14).sql index 2ef9b95dbb2..2ecf70f2cab 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,14).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,15).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,15).sql index 63dc704e0c4..c35c8698ab0 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,15).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,14).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,14).sql index 9493bd99fc0..d4d9ec3f75c 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,14).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,15).sql b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,15).sql index 38fb0c0c162..6bcb71651a9 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,15).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.LinqService).sql index f99db9f6ba1..f9458edba6e 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.LinqService).sql index 09999810e7c..3653479d205 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.LinqService).sql @@ -2,13 +2,13 @@ -- SQLite.Classic SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.LinqService).sql index fb5491fe868..3b35eef652f 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.LinqService).sql index 2d211d6fe6a..cc0c45c1e2d 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.LinqService).sql index 9c3d5cb4a45..65304909055 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.LinqService).sql index fb7fa984ec5..012ed0970f8 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.LinqService).sql index 0901e558be2..476f8c6741b 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.LinqService).sql index e96b8b4550b..9b32288f9f2 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.LinqService).sql index e96b8b4550b..3eba4e5df42 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.LinqService).sql index 80e616ce807..1961ebc9fb3 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.LinqService).sql index 9a2917c132a..c28dd3303ec 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.LinqService).sql @@ -2,17 +2,21 @@ -- SQLite.Classic SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..682eb1cf2ad --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.Classic SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 1 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 2 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 3 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 4 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.LinqService).sql index 05000cf19cb..1601777dc30 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.LinqService).sql @@ -86,14 +86,14 @@ BeforeExecute -- SQLite.Classic SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -103,7 +103,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.Classic SQLite diff --git a/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.LinqService).sql index a94031b2a30..81f695157fc 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.LinqService).sql @@ -89,8 +89,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..a833cb5a47b --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..abe5adf2b89 --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.LinqService).sql index dd56fe5ed9a..abe5adf2b89 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.LinqService).sql @@ -2,17 +2,10 @@ -- SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.LinqService).sql index ce5f16f7646..5ce65693537 100644 --- a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.LinqService).sql @@ -2,14 +2,10 @@ -- SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..276add515d8 --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..b1e562c6f8c --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..5ce65693537 --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..9c9a6654894 --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..dd56fe5ed9a --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.LinqService).sql new file mode 100644 index 00000000000..ce5f16f7646 --- /dev/null +++ b/SQLite.Classic.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,False).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,False).sql index e5cb1b4d85f..fc9c012f5fa 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,False).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,True).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,True).sql index e5cb1b4d85f..fc9c012f5fa 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,True).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,False).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,False).sql index 003d3a7ce23..af524e64140 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,False).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,True).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,True).sql index 003d3a7ce23..af524e64140 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,True).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.LinqService).sql index 916905f425f..039bd18575b 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.LinqService).sql index 5700041143b..dfd0c3b16e2 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.LinqService).sql b/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.LinqService).sql index 27b40dbbb20..7088efc00bb 100644 --- a/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.LinqService).sql +++ b/SQLite.Classic.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM.LinqService).sql index c39eebb7740..b0c8d7b6745 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM.LinqService).sql @@ -2,14 +2,14 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM.LinqService).sql index 6d4cb1181cf..3e1ce8a03c7 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM.LinqService,False).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM.LinqService,False).sql index 5ae22a8eba9..1d57902e5ea 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM.LinqService,False).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM.LinqService).sql index 36003b85e60..bc4049cad3b 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM.LinqService).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM.LinqService).sql index 35c08887acb..50e540fa3ec 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,1).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,1).sql index 2b67ae1061a..e5cab37690b 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,1).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,2).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,2).sql index 94f0fac16b4..8fdb6c4ea89 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,2).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM.LinqService,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM.LinqService).sql index 550c5296610..32a74f21ad7 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,14).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,14).sql index c67e1780da7..8ca967ff0f8 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,14).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,15).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,15).sql index 80ebdb3192d..608b303e406 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,15).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,14).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,14).sql index 9187c93472b..9c6652aebba 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,14).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,15).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,15).sql index 0f303df1cef..a6df3401c73 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,15).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,14).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,14).sql index 42460cb1c9c..299adbd285b 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,14).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,15).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,15).sql index e8a4f2f4015..60464d6fd01 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,15).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,14).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,14).sql index bbecae6954d..35eca1f6139 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,14).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,15).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,15).sql index b977ff93297..65a49b1d9f7 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,15).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM.LinqService).sql index 561ab8beff6..053ea536b29 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM.LinqService).sql index 29f5ba0d526..08de93c64e9 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM.LinqService).sql @@ -2,13 +2,13 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM.LinqService).sql index ed4a4b25d0b..5e296d193fd 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM.LinqService).sql index ee4e18f99cc..774817512d5 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM.LinqService).sql index 0c893d75848..5a6290d0d8b 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM.LinqService).sql index 8a99508a11e..6bd0b5d34b0 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM.LinqService).sql index 2ec3370ff65..1ac0776cedc 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM.LinqService).sql index 4660b502374..ef9ffbf7312 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM.LinqService).sql index 4660b502374..25d1e5708fa 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM.LinqService).sql index 6687c6d0cbe..19a01fdbacc 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM.LinqService).sql index fea954c8efd..0254b5d7536 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM.LinqService).sql @@ -2,17 +2,21 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..6f551f02fca --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 1 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 2 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 3 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 4 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM.LinqService).sql index 039e81e529e..a44660ffd8d 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM.LinqService).sql @@ -86,14 +86,14 @@ BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -103,7 +103,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM.LinqService).sql index ed02ba7dd50..ee8fcf510dc 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM.LinqService).sql @@ -89,8 +89,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..da5e2476c68 --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..7d9695c95de --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM.LinqService).sql index fa5840f116a..7d9695c95de 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM.LinqService).sql @@ -2,17 +2,10 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM.LinqService).sql index cbad1cb6d1e..77b2702891d 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM.LinqService).sql @@ -2,14 +2,10 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..18c3220078b --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..c564a9da938 --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..77b2702891d --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..70cb48588b9 --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..fa5840f116a --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPM.LinqService).sql new file mode 100644 index 00000000000..cbad1cb6d1e --- /dev/null +++ b/SQLite.Classic.MPM.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPM.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,False).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,False).sql index 13e678c4b04..83a9cf87d30 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,False).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,True).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,True).sql index 13e678c4b04..83a9cf87d30 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,True).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,False).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,False).sql index c8e9f20acac..008c46597f2 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,False).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,True).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,True).sql index c8e9f20acac..008c46597f2 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,True).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM.LinqService).sql index 5ef6fc2b286..d11a89e88e2 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM.LinqService).sql index 9ae041a000c..63a81a27d04 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM.LinqService).sql b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM.LinqService).sql index bfc37411f5e..a50fe063439 100644 --- a/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM.LinqService).sql +++ b/SQLite.Classic.MPM.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPM/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM).sql index c39eebb7740..b0c8d7b6745 100644 --- a/SQLite.Classic.MPM/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPM).sql @@ -2,14 +2,14 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM).sql index 6d4cb1181cf..3e1ce8a03c7 100644 --- a/SQLite.Classic.MPM/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPM).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM,False).sql b/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM,False).sql index ea408178508..5bc9c35eac9 100644 --- a/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM,False).sql +++ b/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPM,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite diff --git a/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM).sql index 36003b85e60..bc4049cad3b 100644 --- a/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPM).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM).sql index dc5f0bbe3f9..65a77c22dc3 100644 --- a/SQLite.Classic.MPM/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPM).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,1).sql b/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,1).sql index 2b67ae1061a..e5cab37690b 100644 --- a/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,1).sql +++ b/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,2).sql b/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,2).sql index 94f0fac16b4..8fdb6c4ea89 100644 --- a/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,2).sql +++ b/SQLite.Classic.MPM/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPM,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPM/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM).sql index 550c5296610..32a74f21ad7 100644 --- a/SQLite.Classic.MPM/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPM).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,14).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,14).sql index 88c76af4d46..0de9f2092fa 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,14).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,15).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,15).sql index 227d4aeb6b7..c2cba7010ad 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,15).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPM,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,14).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,14).sql index d95242b9eb8..a032109f0b0 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,14).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,15).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,15).sql index 97ded7f706c..f9550ebc2b8 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,15).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPM,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,14).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,14).sql index 5700ae5286b..295010f8433 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,14).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,15).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,15).sql index edb2c3067d4..97704917f7c 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,15).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPM,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,14).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,14).sql index 475e72f682d..833d0c8832c 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,14).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,15).sql b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,15).sql index bd0fe741fba..505f33d952d 100644 --- a/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,15).sql +++ b/SQLite.Classic.MPM/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPM,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPM/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPM).sql index 571a62b3b48..820c25d4bbc 100644 --- a/SQLite.Classic.MPM/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPM).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = 'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM).sql index 561ab8beff6..053ea536b29 100644 --- a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPM).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM).sql index 29f5ba0d526..08de93c64e9 100644 --- a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPM).sql @@ -2,13 +2,13 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM).sql index ed4a4b25d0b..5e296d193fd 100644 --- a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPM).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM).sql index ee4e18f99cc..774817512d5 100644 --- a/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPM).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM).sql index 30accd34e8f..59d2891d306 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPM).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM).sql index 88515b6b84e..ecbcb3e68b5 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPM).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM).sql index 2ec3370ff65..1ac0776cedc 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPM).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM).sql index 4660b502374..ef9ffbf7312 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPM).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM).sql index 4660b502374..25d1e5708fa 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPM).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM).sql index 6687c6d0cbe..19a01fdbacc 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPM).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM).sql index fea954c8efd..0254b5d7536 100644 --- a/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPM).sql @@ -2,17 +2,21 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..335d65f0a3f --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPM).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPM).sql index 8c0fafaa8da..4068bc7327a 100644 --- a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPM).sql @@ -2,130 +2,130 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [t1].[ParentID_6], - [t1].[Value1], [t1].[ParentID], + [t1].[Value1], + [t1].[ParentID_1], [t1].[ChildID], [t1].[Any_1], [t1].[ChildID_1], - [t1].[ParentID_1], - [t1].[ChildID_2], [t1].[ParentID_2], - [t1].[ChildID_3], + [t1].[ChildID_2], [t1].[ParentID_3], - [t1].[ChildID_4], + [t1].[ChildID_3], [t1].[ParentID_4], + [t1].[ChildID_4], + [t1].[ParentID_5], [t1].[ChildID_5], - [t1].[ParentID_5] + [t1].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], + [p].[ParentID], + [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], [c1_1].[ChildID], + CASE + WHEN EXISTS( + SELECT + * + FROM + [Child] [c_1] + WHERE + [c_1].[ChildID] > 2 + ) + THEN 1 + ELSE 0 + END as [Any_1], ( SELECT - [c_1].[ChildID] - FROM - [Child] [c_1] - WHERE - [c_1].[ChildID] > 2 AND [c_1].[ParentID] >= [p].[ParentID] - LIMIT 1 - ) as [ChildID_1], - ( - SELECT - [c_2].[ParentID] + [c_2].[ChildID] FROM [Child] [c_2] WHERE [c_2].[ChildID] > 2 AND [c_2].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_1], + ) as [ChildID_1], ( SELECT - [c_3].[ChildID] + [c_3].[ParentID] FROM [Child] [c_3] WHERE - [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= 2 + [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_2], + ) as [ParentID_2], ( SELECT - [c_4].[ParentID] + [c_4].[ChildID] FROM [Child] [c_4] WHERE [c_4].[ChildID] > 2 AND [c_4].[ParentID] >= 2 LIMIT 1 - ) as [ParentID_2], + ) as [ChildID_2], ( SELECT - [c_5].[ChildID] + [c_5].[ParentID] FROM [Child] [c_5] WHERE - [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= [p].[ParentID] + [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= 2 LIMIT 1 - ) as [ChildID_3], + ) as [ParentID_3], ( SELECT - [c_6].[ParentID] + [c_6].[ChildID] FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 AND [c_6].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_3], + ) as [ChildID_3], ( SELECT - [c_7].[ChildID] + [c_7].[ParentID] FROM [Child] [c_7] WHERE [c_7].[ChildID] > 2 AND [c_7].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_4], + ) as [ParentID_4], ( SELECT - [c_8].[ParentID] + [c_8].[ChildID] FROM [Child] [c_8] WHERE [c_8].[ChildID] > 2 AND [c_8].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_4], + ) as [ChildID_4], ( SELECT - [c_9].[ChildID] + [c_9].[ParentID] FROM [Child] [c_9] WHERE [c_9].[ChildID] > 2 AND [c_9].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_5], + ) as [ParentID_5], ( SELECT - [c_10].[ParentID] + [c_10].[ChildID] FROM [Child] [c_10] WHERE [c_10].[ChildID] > 2 AND [c_10].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_5], - [p].[ParentID] as [ParentID_6], - [p].[Value1], - CASE - WHEN EXISTS( - SELECT - * - FROM - [Child] [c_11] - WHERE - [c_11].[ChildID] > 2 - ) - THEN 1 - ELSE 0 - END as [Any_1] + ) as [ChildID_5], + ( + SELECT + [c_11].[ParentID] + FROM + [Child] [c_11] + WHERE + [c_11].[ChildID] > 2 AND [c_11].[ParentID] >= [p].[ParentID] + LIMIT 1 + ) as [ParentID_6] FROM [Parent] [p] LEFT JOIN ( @@ -138,5 +138,5 @@ FROM ) [c1_1] ON [c1_1].[ParentID] = [p].[ParentID] AND [c1_1].[rn] <= 1 ) [t1] ORDER BY - [t1].[ParentID_6] + [t1].[ParentID] diff --git a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM).sql index b6fa6177983..6680b8494b9 100644 --- a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPM).sql @@ -55,14 +55,14 @@ BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -72,7 +72,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite diff --git a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM).sql index 5cb928a0d81..d167a2cb846 100644 --- a/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPM).sql @@ -58,8 +58,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..da5e2476c68 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPM).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..7d9695c95de --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPM).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM).sql index fa5840f116a..7d9695c95de 100644 --- a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPM).sql @@ -2,17 +2,10 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM).sql index cbad1cb6d1e..77b2702891d 100644 --- a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPM).sql @@ -2,14 +2,10 @@ -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..18c3220078b --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPM).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..c564a9da938 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPM).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..77b2702891d --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPM).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..70cb48588b9 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPM).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..fa5840f116a --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPM).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPM).sql new file mode 100644 index 00000000000..cbad1cb6d1e --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPM).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPM).sql index c71ba4b7f59..8717da2ed2f 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPM).sql @@ -81,21 +81,21 @@ DECLARE @id -- Int32 SET @id = 0 SELECT - [s_1].[TextCol], - [s_1].[b1], - [s_1].[b2], - [s_1].[b3] + [bt1].[textCol], + [t1].[b1], + [t1].[b2], + [t1].[b3] FROM - ( - SELECT - Coalesce([btbl].[col1], '') as [b1], - Coalesce([btbl].[col2], '') as [b2], - Coalesce([btbl].[col3], '') as [b3], - [bt1].[textCol] as [TextCol] - FROM - [table1] [s] - LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] - LEFT JOIN ( + [table1] [s] + LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] + LEFT JOIN ( + SELECT + Coalesce([ctb].[Col3], 0) as [c1], + Coalesce([btbl].[col1], '') as [b1], + Coalesce([btbl].[col2], '') as [b2], + Coalesce([btbl].[col3], '') as [b3] + FROM + ( SELECT MAX([tbl3].[id]) as [maxCol], [tbl2].[col3] as [Col3] @@ -107,18 +107,18 @@ FROM [w].[commonTableId] = @id AND [tbl2].[col3] IS NOT NULL GROUP BY [tbl2].[col3] - ) [ctb] ON [bt1].[col3] = Coalesce([ctb].[Col3], 0) - LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] - LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] - LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) - WHERE - [s].[commonTableId] = @id - ) [s_1] + ) [ctb] + LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] + LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] + ) [t1] ON [bt1].[col3] = [t1].[c1] + LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) +WHERE + [s].[commonTableId] = @id GROUP BY - [s_1].[b1], - [s_1].[b2], - [s_1].[b3], - [s_1].[TextCol] + [t1].[b1], + [t1].[b2], + [t1].[b3], + [bt1].[textCol] BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,False).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,False).sql index 13e678c4b04..83a9cf87d30 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,False).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,True).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,True).sql index 13e678c4b04..83a9cf87d30 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,True).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPM,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,False).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,False).sql index c8e9f20acac..008c46597f2 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,False).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,True).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,True).sql index c8e9f20acac..008c46597f2 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,True).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPM,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPM).sql index 5a83c0b5446..ef21ed5acc3 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPM).sql @@ -122,7 +122,7 @@ BeforeExecute -- SQLite.Classic.MPM SQLite.Classic SQLite SELECT - [t5].[SUM_1], + [t5].[WithParentReference], [t5].[WithParentReferenceCustom1], [t5].[WithParentReferenceCustom2], [t5].[WithoutParentReference] @@ -153,7 +153,7 @@ FROM WHERE [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t5] ORDER BY - Coalesce([t5].[SUM_1], 0), + Coalesce([t5].[WithParentReference], 0), Coalesce([t5].[WithParentReferenceCustom1], 0), Coalesce([t5].[WithParentReferenceCustom2], 0), Coalesce([t5].[WithoutParentReference], 0) DESC diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM).sql index 5ef6fc2b286..d11a89e88e2 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPM).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM).sql index 9ae041a000c..63a81a27d04 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPM).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM).sql index bfc37411f5e..a50fe063439 100644 --- a/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM).sql +++ b/SQLite.Classic.MPM/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPM).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU.LinqService).sql index 6633974f64f..caf2f88c8fd 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU.LinqService).sql @@ -2,14 +2,14 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU.LinqService).sql index 2d677e3fc16..58dc52a0bd3 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU.LinqService,False).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU.LinqService,False).sql index 5582749869e..a182fb21b08 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU.LinqService,False).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU.LinqService).sql index d1027d3ac39..faf94f7a291 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU.LinqService).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU.LinqService).sql index 1b473aa52fe..501ed999951 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,1).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,1).sql index 4c4ccfbeb29..47df988734a 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,1).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,2).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,2).sql index 40ca0783738..f84d0d0747b 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,2).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU.LinqService,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU.LinqService).sql index 306fda7f8ec..f057df13b89 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,14).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,14).sql index 9ff9dad1fd7..65488af7ce2 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,14).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,15).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,15).sql index 11123bb90a8..7373b8aa91e 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,15).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,14).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,14).sql index 4e4f58e51b5..02113d5711d 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,14).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,15).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,15).sql index 8bfbdf99cd4..291391f2245 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,15).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,14).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,14).sql index f070e45e01b..548d652ee9d 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,14).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,15).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,15).sql index 8bc8d62d1e2..d371f064574 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,15).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,14).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,14).sql index c0daf6300b1..77603fd1928 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,14).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,15).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,15).sql index f34e43a685f..af8bae8412e 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,15).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU.LinqService).sql index f446f842efe..432ddf5af0c 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU.LinqService).sql index e1d04f9a95c..ce35cd72ca9 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU.LinqService).sql @@ -2,13 +2,13 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU.LinqService).sql index 59a7daa0d66..39fec4f8c74 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU.LinqService).sql index 92ff6b50bca..885c34b43b5 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU.LinqService).sql index 7a57ae7557f..dd10f42bb48 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU.LinqService).sql index bde5239699b..d3da0ee6286 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU.LinqService).sql index ea1b2a693d5..53c9e31d518 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU.LinqService).sql index 55aed00bb8f..630fa085513 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU.LinqService).sql index 55aed00bb8f..5eba8148fd5 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU.LinqService).sql index f934e3674fe..f0a6bb5fd00 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU.LinqService).sql index dbbffb2493e..42cf6355bd1 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU.LinqService).sql @@ -2,17 +2,21 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..59257029e1c --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 1 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 2 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 3 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite +DECLARE @Id -- Int32 +SET @Id = 4 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU.LinqService).sql index dea008e0207..b9d040e6566 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU.LinqService).sql @@ -86,14 +86,14 @@ BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -103,7 +103,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU.LinqService).sql index ae7fd2417e6..ea8b82eb1d1 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU.LinqService).sql @@ -89,8 +89,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..99031ceeb4e --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..0acfc629c1b --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU.LinqService).sql index 892e911fbd5..0acfc629c1b 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU.LinqService).sql @@ -2,17 +2,10 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU.LinqService).sql index 99f3834cf3f..3abe91bd4f1 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU.LinqService).sql @@ -2,14 +2,10 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..e37f0a5b618 --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..5fc687643df --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..3abe91bd4f1 --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..bf9771169f1 --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..892e911fbd5 --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPU.LinqService).sql new file mode 100644 index 00000000000..99f3834cf3f --- /dev/null +++ b/SQLite.Classic.MPU.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPU.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,False).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,False).sql index e881f094bed..4f9537646c9 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,False).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,True).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,True).sql index e881f094bed..4f9537646c9 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,True).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,False).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,False).sql index 75ac8b4d23a..d352ab261cd 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,False).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,True).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,True).sql index 75ac8b4d23a..d352ab261cd 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,True).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU.LinqService).sql index 32a05dbb0b0..9f6ac0bdee7 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU.LinqService).sql index 926b7e15875..01f6b600c48 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU.LinqService).sql b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU.LinqService).sql index 195e40b4cce..d6b88b36a83 100644 --- a/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU.LinqService).sql +++ b/SQLite.Classic.MPU.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPU/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU).sql index 6633974f64f..caf2f88c8fd 100644 --- a/SQLite.Classic.MPU/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic.MPU).sql @@ -2,14 +2,14 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU).sql index 2d677e3fc16..58dc52a0bd3 100644 --- a/SQLite.Classic.MPU/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic.MPU).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU,False).sql b/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU,False).sql index 7bd88c71d8c..55b58a32640 100644 --- a/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU,False).sql +++ b/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic.MPU,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite diff --git a/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU).sql index d1027d3ac39..faf94f7a291 100644 --- a/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic.MPU).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU).sql index a38f155d6c4..60ee12439b7 100644 --- a/SQLite.Classic.MPU/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic.MPU).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,1).sql b/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,1).sql index 4c4ccfbeb29..47df988734a 100644 --- a/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,1).sql +++ b/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,2).sql b/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,2).sql index 40ca0783738..f84d0d0747b 100644 --- a/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,2).sql +++ b/SQLite.Classic.MPU/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic.MPU,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic.MPU/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU).sql index 306fda7f8ec..f057df13b89 100644 --- a/SQLite.Classic.MPU/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic.MPU).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,14).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,14).sql index 9c8d8fff2a9..b75dc0a2b16 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,14).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,15).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,15).sql index 7d1f7bf4371..86bb0c226c4 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,15).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic.MPU,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,14).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,14).sql index ed4840cd620..dd5b8a903e6 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,14).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,15).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,15).sql index 92df11ab54e..79d58029b9c 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,15).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic.MPU,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,14).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,14).sql index 29f31daf19c..9b2cbfcbf3b 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,14).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,15).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,15).sql index c6246f98e97..bf148154bad 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,15).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic.MPU,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,14).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,14).sql index 9b712273681..7c2f53513a0 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,14).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,15).sql b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,15).sql index 8520e684387..abe18cb538e 100644 --- a/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,15).sql +++ b/SQLite.Classic.MPU/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic.MPU,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic.MPU/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPU).sql index a5da978aa60..748443c077f 100644 --- a/SQLite.Classic.MPU/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic.MPU).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = 'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU).sql index f446f842efe..432ddf5af0c 100644 --- a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic.MPU).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU).sql index e1d04f9a95c..ce35cd72ca9 100644 --- a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic.MPU).sql @@ -2,13 +2,13 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU).sql index 59a7daa0d66..39fec4f8c74 100644 --- a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic.MPU).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU).sql index 92ff6b50bca..885c34b43b5 100644 --- a/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic.MPU).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU).sql index 950b51feb0b..909d9a074d0 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic.MPU).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU).sql index 22c7e9da760..d6945dee917 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic.MPU).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU).sql index ea1b2a693d5..53c9e31d518 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic.MPU).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU).sql index 55aed00bb8f..630fa085513 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic.MPU).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU).sql index 55aed00bb8f..5eba8148fd5 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic.MPU).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU).sql index f934e3674fe..f0a6bb5fd00 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic.MPU).sql @@ -2,11 +2,11 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU).sql index dbbffb2493e..42cf6355bd1 100644 --- a/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic.MPU).sql @@ -2,17 +2,21 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..17f32e627f5 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic.MPU).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPU).sql index c68f95a7afc..7a8384ff2ae 100644 --- a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic.MPU).sql @@ -2,130 +2,130 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [t1].[ParentID_6], - [t1].[Value1], [t1].[ParentID], + [t1].[Value1], + [t1].[ParentID_1], [t1].[ChildID], [t1].[Any_1], [t1].[ChildID_1], - [t1].[ParentID_1], - [t1].[ChildID_2], [t1].[ParentID_2], - [t1].[ChildID_3], + [t1].[ChildID_2], [t1].[ParentID_3], - [t1].[ChildID_4], + [t1].[ChildID_3], [t1].[ParentID_4], + [t1].[ChildID_4], + [t1].[ParentID_5], [t1].[ChildID_5], - [t1].[ParentID_5] + [t1].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], + [p].[ParentID], + [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], [c1_1].[ChildID], + CASE + WHEN EXISTS( + SELECT + * + FROM + [Child] [c_1] + WHERE + [c_1].[ChildID] > 2 + ) + THEN 1 + ELSE 0 + END as [Any_1], ( SELECT - [c_1].[ChildID] - FROM - [Child] [c_1] - WHERE - [c_1].[ChildID] > 2 AND [c_1].[ParentID] >= [p].[ParentID] - LIMIT 1 - ) as [ChildID_1], - ( - SELECT - [c_2].[ParentID] + [c_2].[ChildID] FROM [Child] [c_2] WHERE [c_2].[ChildID] > 2 AND [c_2].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_1], + ) as [ChildID_1], ( SELECT - [c_3].[ChildID] + [c_3].[ParentID] FROM [Child] [c_3] WHERE - [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= 2 + [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_2], + ) as [ParentID_2], ( SELECT - [c_4].[ParentID] + [c_4].[ChildID] FROM [Child] [c_4] WHERE [c_4].[ChildID] > 2 AND [c_4].[ParentID] >= 2 LIMIT 1 - ) as [ParentID_2], + ) as [ChildID_2], ( SELECT - [c_5].[ChildID] + [c_5].[ParentID] FROM [Child] [c_5] WHERE - [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= [p].[ParentID] + [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= 2 LIMIT 1 - ) as [ChildID_3], + ) as [ParentID_3], ( SELECT - [c_6].[ParentID] + [c_6].[ChildID] FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 AND [c_6].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_3], + ) as [ChildID_3], ( SELECT - [c_7].[ChildID] + [c_7].[ParentID] FROM [Child] [c_7] WHERE [c_7].[ChildID] > 2 AND [c_7].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_4], + ) as [ParentID_4], ( SELECT - [c_8].[ParentID] + [c_8].[ChildID] FROM [Child] [c_8] WHERE [c_8].[ChildID] > 2 AND [c_8].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_4], + ) as [ChildID_4], ( SELECT - [c_9].[ChildID] + [c_9].[ParentID] FROM [Child] [c_9] WHERE [c_9].[ChildID] > 2 AND [c_9].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_5], + ) as [ParentID_5], ( SELECT - [c_10].[ParentID] + [c_10].[ChildID] FROM [Child] [c_10] WHERE [c_10].[ChildID] > 2 AND [c_10].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_5], - [p].[ParentID] as [ParentID_6], - [p].[Value1], - CASE - WHEN EXISTS( - SELECT - * - FROM - [Child] [c_11] - WHERE - [c_11].[ChildID] > 2 - ) - THEN 1 - ELSE 0 - END as [Any_1] + ) as [ChildID_5], + ( + SELECT + [c_11].[ParentID] + FROM + [Child] [c_11] + WHERE + [c_11].[ChildID] > 2 AND [c_11].[ParentID] >= [p].[ParentID] + LIMIT 1 + ) as [ParentID_6] FROM [Parent] [p] LEFT JOIN ( @@ -138,5 +138,5 @@ FROM ) [c1_1] ON [c1_1].[ParentID] = [p].[ParentID] AND [c1_1].[rn] <= 1 ) [t1] ORDER BY - [t1].[ParentID_6] + [t1].[ParentID] diff --git a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU).sql index d4d6a968970..e588dc728df 100644 --- a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic.MPU).sql @@ -55,14 +55,14 @@ BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -72,7 +72,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite diff --git a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU).sql index 2ae7936fa1f..cd9e28af84e 100644 --- a/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic.MPU).sql @@ -58,8 +58,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..99031ceeb4e --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic.MPU).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..0acfc629c1b --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic.MPU).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU).sql index 892e911fbd5..0acfc629c1b 100644 --- a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic.MPU).sql @@ -2,17 +2,10 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU).sql index 99f3834cf3f..3abe91bd4f1 100644 --- a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic.MPU).sql @@ -2,14 +2,10 @@ -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..e37f0a5b618 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic.MPU).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..5fc687643df --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic.MPU).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..3abe91bd4f1 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic.MPU).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..bf9771169f1 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic.MPU).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..892e911fbd5 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic.MPU).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPU).sql new file mode 100644 index 00000000000..99f3834cf3f --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic.MPU).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPU).sql index eaac221b02a..b0bb46c6b1c 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic.MPU).sql @@ -81,21 +81,21 @@ DECLARE @id -- Int32 SET @id = 0 SELECT - [s_1].[TextCol], - [s_1].[b1], - [s_1].[b2], - [s_1].[b3] + [bt1].[textCol], + [t1].[b1], + [t1].[b2], + [t1].[b3] FROM - ( - SELECT - Coalesce([btbl].[col1], '') as [b1], - Coalesce([btbl].[col2], '') as [b2], - Coalesce([btbl].[col3], '') as [b3], - [bt1].[textCol] as [TextCol] - FROM - [table1] [s] - LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] - LEFT JOIN ( + [table1] [s] + LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] + LEFT JOIN ( + SELECT + Coalesce([ctb].[Col3], 0) as [c1], + Coalesce([btbl].[col1], '') as [b1], + Coalesce([btbl].[col2], '') as [b2], + Coalesce([btbl].[col3], '') as [b3] + FROM + ( SELECT MAX([tbl3].[id]) as [maxCol], [tbl2].[col3] as [Col3] @@ -107,18 +107,18 @@ FROM [w].[commonTableId] = @id AND [tbl2].[col3] IS NOT NULL GROUP BY [tbl2].[col3] - ) [ctb] ON [bt1].[col3] = Coalesce([ctb].[Col3], 0) - LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] - LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] - LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) - WHERE - [s].[commonTableId] = @id - ) [s_1] + ) [ctb] + LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] + LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] + ) [t1] ON [bt1].[col3] = [t1].[c1] + LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) +WHERE + [s].[commonTableId] = @id GROUP BY - [s_1].[b1], - [s_1].[b2], - [s_1].[b3], - [s_1].[TextCol] + [t1].[b1], + [t1].[b2], + [t1].[b3], + [bt1].[textCol] BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,False).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,False).sql index e881f094bed..4f9537646c9 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,False).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,True).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,True).sql index e881f094bed..4f9537646c9 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,True).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic.MPU,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,False).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,False).sql index 75ac8b4d23a..d352ab261cd 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,False).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,True).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,True).sql index 75ac8b4d23a..d352ab261cd 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,True).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic.MPU,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPU).sql index 3a76faa90be..1c51a4ebc52 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic.MPU).sql @@ -122,7 +122,7 @@ BeforeExecute -- SQLite.Classic.MPU SQLite.Classic SQLite SELECT - [t5].[SUM_1], + [t5].[WithParentReference], [t5].[WithParentReferenceCustom1], [t5].[WithParentReferenceCustom2], [t5].[WithoutParentReference] @@ -153,7 +153,7 @@ FROM WHERE [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t5] ORDER BY - Coalesce([t5].[SUM_1], 0), + Coalesce([t5].[WithParentReference], 0), Coalesce([t5].[WithParentReferenceCustom1], 0), Coalesce([t5].[WithParentReferenceCustom2], 0), Coalesce([t5].[WithoutParentReference], 0) DESC diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU).sql index 32a05dbb0b0..9f6ac0bdee7 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic.MPU).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU).sql index 926b7e15875..01f6b600c48 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic.MPU).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU).sql index 195e40b4cce..d6b88b36a83 100644 --- a/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU).sql +++ b/SQLite.Classic.MPU/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic.MPU).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic).sql index cf2c66186b5..b91bd02da7a 100644 --- a/SQLite.Classic/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.Classic).sql @@ -2,14 +2,14 @@ -- SQLite.Classic SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic).sql index 714aff53066..4b3671806ea 100644 --- a/SQLite.Classic/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.Classic).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic,False).sql b/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic,False).sql index a106ed680dd..f4bb5654fc6 100644 --- a/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic,False).sql +++ b/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.Classic,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- SQLite.Classic SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.Classic SQLite diff --git a/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic).sql index 2dd31d180d3..22ec2e9d76c 100644 --- a/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.Classic).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic).sql index 607a1755a80..0483e560da1 100644 --- a/SQLite.Classic/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.Classic).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,1).sql b/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,1).sql index 94b61070f7d..6a28a924264 100644 --- a/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,1).sql +++ b/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,2).sql b/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,2).sql index dfcbba4fe7b..906183b0a8d 100644 --- a/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,2).sql +++ b/SQLite.Classic/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.Classic,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.Classic/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic).sql index 607785970db..5578bdcd2d7 100644 --- a/SQLite.Classic/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.Classic).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,14).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,14).sql index 6b72207a223..1fe5222343f 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,14).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,15).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,15).sql index 727f730f7de..a7a97c8f70c 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,15).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.Classic,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,14).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,14).sql index 7a7513c750d..6db9c473bab 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,14).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,15).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,15).sql index c573ae935cb..7082a7be61b 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,15).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.Classic,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,14).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,14).sql index 5630c6542e6..2a70862dbf7 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,14).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,15).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,15).sql index c661e9b7c12..14155463407 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,15).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.Classic,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,14).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,14).sql index f6fae529265..93f51eaf9ae 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,14).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,15).sql b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,15).sql index 96ba7b37aa2..2d7f6902b3d 100644 --- a/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,15).sql +++ b/SQLite.Classic/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.Classic,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.Classic/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic).sql index abfe57a695a..00deec7e84d 100644 --- a/SQLite.Classic/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.Classic).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = 'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic).sql index f99db9f6ba1..f9458edba6e 100644 --- a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.Classic).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic).sql index 09999810e7c..3653479d205 100644 --- a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.Classic).sql @@ -2,13 +2,13 @@ -- SQLite.Classic SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic).sql index fb5491fe868..3b35eef652f 100644 --- a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.Classic).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic).sql index 2d211d6fe6a..cc0c45c1e2d 100644 --- a/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.Classic).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic).sql index 1be8e92bd2d..727066cff2d 100644 --- a/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.Classic).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic).sql index fbf22908c11..ac994a6c5c9 100644 --- a/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.Classic).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic).sql index 0901e558be2..476f8c6741b 100644 --- a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.Classic).sql @@ -2,11 +2,11 @@ -- SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic).sql index e96b8b4550b..9b32288f9f2 100644 --- a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.Classic).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic).sql index e96b8b4550b..3eba4e5df42 100644 --- a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.Classic).sql @@ -2,11 +2,11 @@ -- SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic).sql index 80e616ce807..1961ebc9fb3 100644 --- a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.Classic).sql @@ -2,11 +2,11 @@ -- SQLite.Classic SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic).sql index 9a2917c132a..c28dd3303ec 100644 --- a/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.Classic).sql @@ -2,17 +2,21 @@ -- SQLite.Classic SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic).sql new file mode 100644 index 00000000000..774ea804ca6 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.Classic).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.Classic SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.Classic SQLite + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.Classic SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic).sql index e4904069c5a..ab2e4db7bc8 100644 --- a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.Classic).sql @@ -2,130 +2,130 @@ -- SQLite.Classic SQLite SELECT - [t1].[ParentID_6], - [t1].[Value1], [t1].[ParentID], + [t1].[Value1], + [t1].[ParentID_1], [t1].[ChildID], [t1].[Any_1], [t1].[ChildID_1], - [t1].[ParentID_1], - [t1].[ChildID_2], [t1].[ParentID_2], - [t1].[ChildID_3], + [t1].[ChildID_2], [t1].[ParentID_3], - [t1].[ChildID_4], + [t1].[ChildID_3], [t1].[ParentID_4], + [t1].[ChildID_4], + [t1].[ParentID_5], [t1].[ChildID_5], - [t1].[ParentID_5] + [t1].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], + [p].[ParentID], + [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], [c1_1].[ChildID], + CASE + WHEN EXISTS( + SELECT + * + FROM + [Child] [c_1] + WHERE + [c_1].[ChildID] > 2 + ) + THEN 1 + ELSE 0 + END as [Any_1], ( SELECT - [c_1].[ChildID] - FROM - [Child] [c_1] - WHERE - [c_1].[ChildID] > 2 AND [c_1].[ParentID] >= [p].[ParentID] - LIMIT 1 - ) as [ChildID_1], - ( - SELECT - [c_2].[ParentID] + [c_2].[ChildID] FROM [Child] [c_2] WHERE [c_2].[ChildID] > 2 AND [c_2].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_1], + ) as [ChildID_1], ( SELECT - [c_3].[ChildID] + [c_3].[ParentID] FROM [Child] [c_3] WHERE - [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= 2 + [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_2], + ) as [ParentID_2], ( SELECT - [c_4].[ParentID] + [c_4].[ChildID] FROM [Child] [c_4] WHERE [c_4].[ChildID] > 2 AND [c_4].[ParentID] >= 2 LIMIT 1 - ) as [ParentID_2], + ) as [ChildID_2], ( SELECT - [c_5].[ChildID] + [c_5].[ParentID] FROM [Child] [c_5] WHERE - [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= [p].[ParentID] + [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= 2 LIMIT 1 - ) as [ChildID_3], + ) as [ParentID_3], ( SELECT - [c_6].[ParentID] + [c_6].[ChildID] FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 AND [c_6].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_3], + ) as [ChildID_3], ( SELECT - [c_7].[ChildID] + [c_7].[ParentID] FROM [Child] [c_7] WHERE [c_7].[ChildID] > 2 AND [c_7].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_4], + ) as [ParentID_4], ( SELECT - [c_8].[ParentID] + [c_8].[ChildID] FROM [Child] [c_8] WHERE [c_8].[ChildID] > 2 AND [c_8].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_4], + ) as [ChildID_4], ( SELECT - [c_9].[ChildID] + [c_9].[ParentID] FROM [Child] [c_9] WHERE [c_9].[ChildID] > 2 AND [c_9].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_5], + ) as [ParentID_5], ( SELECT - [c_10].[ParentID] + [c_10].[ChildID] FROM [Child] [c_10] WHERE [c_10].[ChildID] > 2 AND [c_10].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_5], - [p].[ParentID] as [ParentID_6], - [p].[Value1], - CASE - WHEN EXISTS( - SELECT - * - FROM - [Child] [c_11] - WHERE - [c_11].[ChildID] > 2 - ) - THEN 1 - ELSE 0 - END as [Any_1] + ) as [ChildID_5], + ( + SELECT + [c_11].[ParentID] + FROM + [Child] [c_11] + WHERE + [c_11].[ChildID] > 2 AND [c_11].[ParentID] >= [p].[ParentID] + LIMIT 1 + ) as [ParentID_6] FROM [Parent] [p] LEFT JOIN ( @@ -138,5 +138,5 @@ FROM ) [c1_1] ON [c1_1].[ParentID] = [p].[ParentID] AND [c1_1].[rn] <= 1 ) [t1] ORDER BY - [t1].[ParentID_6] + [t1].[ParentID] diff --git a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic).sql index 2099642390b..d962b8f8529 100644 --- a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.Classic).sql @@ -55,14 +55,14 @@ BeforeExecute -- SQLite.Classic SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -72,7 +72,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.Classic SQLite diff --git a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic).sql index d7e3cceabd1..e79375a8778 100644 --- a/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.Classic).sql @@ -58,8 +58,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic).sql new file mode 100644 index 00000000000..a833cb5a47b --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.Classic).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic).sql new file mode 100644 index 00000000000..abe5adf2b89 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.Classic).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic).sql index dd56fe5ed9a..abe5adf2b89 100644 --- a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.Classic).sql @@ -2,17 +2,10 @@ -- SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic).sql index ce5f16f7646..5ce65693537 100644 --- a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.Classic).sql @@ -2,14 +2,10 @@ -- SQLite.Classic SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic).sql new file mode 100644 index 00000000000..276add515d8 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.Classic).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic).sql new file mode 100644 index 00000000000..b1e562c6f8c --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.Classic).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic).sql new file mode 100644 index 00000000000..5ce65693537 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.Classic).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic).sql new file mode 100644 index 00000000000..9c9a6654894 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.Classic).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic).sql new file mode 100644 index 00000000000..dd56fe5ed9a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.Classic).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic).sql new file mode 100644 index 00000000000..ce5f16f7646 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.Classic).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.Classic SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.Classic/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic).sql b/SQLite.Classic/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic).sql index 455c8dfb326..ea5334a61fb 100644 --- a/SQLite.Classic/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.Classic).sql @@ -81,21 +81,21 @@ DECLARE @id -- Int32 SET @id = 0 SELECT - [s_1].[TextCol], - [s_1].[b1], - [s_1].[b2], - [s_1].[b3] + [bt1].[textCol], + [t1].[b1], + [t1].[b2], + [t1].[b3] FROM - ( - SELECT - Coalesce([btbl].[col1], '') as [b1], - Coalesce([btbl].[col2], '') as [b2], - Coalesce([btbl].[col3], '') as [b3], - [bt1].[textCol] as [TextCol] - FROM - [table1] [s] - LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] - LEFT JOIN ( + [table1] [s] + LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] + LEFT JOIN ( + SELECT + Coalesce([ctb].[Col3], 0) as [c1], + Coalesce([btbl].[col1], '') as [b1], + Coalesce([btbl].[col2], '') as [b2], + Coalesce([btbl].[col3], '') as [b3] + FROM + ( SELECT MAX([tbl3].[id]) as [maxCol], [tbl2].[col3] as [Col3] @@ -107,18 +107,18 @@ FROM [w].[commonTableId] = @id AND [tbl2].[col3] IS NOT NULL GROUP BY [tbl2].[col3] - ) [ctb] ON [bt1].[col3] = Coalesce([ctb].[Col3], 0) - LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] - LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] - LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) - WHERE - [s].[commonTableId] = @id - ) [s_1] + ) [ctb] + LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] + LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] + ) [t1] ON [bt1].[col3] = [t1].[c1] + LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) +WHERE + [s].[commonTableId] = @id GROUP BY - [s_1].[b1], - [s_1].[b2], - [s_1].[b3], - [s_1].[TextCol] + [t1].[b1], + [t1].[b2], + [t1].[b3], + [bt1].[textCol] BeforeExecute -- SQLite.Classic SQLite diff --git a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,False).sql b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,False).sql index e5cb1b4d85f..fc9c012f5fa 100644 --- a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,False).sql +++ b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,True).sql b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,True).sql index e5cb1b4d85f..fc9c012f5fa 100644 --- a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,True).sql +++ b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.Classic,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,False).sql b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,False).sql index 003d3a7ce23..af524e64140 100644 --- a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,False).sql +++ b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,True).sql b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,True).sql index 003d3a7ce23..af524e64140 100644 --- a/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,True).sql +++ b/SQLite.Classic/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.Classic,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.Classic SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.Classic/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic).sql b/SQLite.Classic/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic).sql index bab9d07ee21..64e570ba439 100644 --- a/SQLite.Classic/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.Classic).sql @@ -122,7 +122,7 @@ BeforeExecute -- SQLite.Classic SQLite SELECT - [t5].[SUM_1], + [t5].[WithParentReference], [t5].[WithParentReferenceCustom1], [t5].[WithParentReferenceCustom2], [t5].[WithoutParentReference] @@ -153,7 +153,7 @@ FROM WHERE [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t5] ORDER BY - Coalesce([t5].[SUM_1], 0), + Coalesce([t5].[WithParentReference], 0), Coalesce([t5].[WithParentReferenceCustom1], 0), Coalesce([t5].[WithParentReferenceCustom2], 0), Coalesce([t5].[WithoutParentReference], 0) DESC diff --git a/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic).sql b/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic).sql index 916905f425f..039bd18575b 100644 --- a/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.Classic).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic).sql b/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic).sql index 5700041143b..dfd0c3b16e2 100644 --- a/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.Classic).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic).sql b/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic).sql index 27b40dbbb20..7088efc00bb 100644 --- a/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic).sql +++ b/SQLite.Classic/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.Classic).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.MS.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS.LinqService).sql index 8e068482812..5672d4b01b0 100644 --- a/SQLite.MS.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS.LinqService).sql @@ -2,14 +2,14 @@ -- SQLite.MS SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS.LinqService).sql index de65ae0958f..090ce64e231 100644 --- a/SQLite.MS.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS.LinqService).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS.LinqService,False).sql b/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS.LinqService,False).sql index 916a42ca2c5..da5992b0392 100644 --- a/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS.LinqService,False).sql +++ b/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS.LinqService,False).sql @@ -107,22 +107,24 @@ BeforeExecute -- SQLite.MS SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.MS SQLite diff --git a/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS.LinqService).sql index 73ad67e1d2b..38a3f956a8a 100644 --- a/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS.LinqService).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS.LinqService).sql index ab514720215..17a3360b5e6 100644 --- a/SQLite.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,1).sql b/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,1).sql index a66b06dd7cf..f95d2f337be 100644 --- a/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,1).sql +++ b/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,2).sql b/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,2).sql index 1ea3f810158..dd58531377c 100644 --- a/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,2).sql +++ b/SQLite.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS.LinqService,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS.LinqService).sql index 53f0e29f2d8..9ed668616a4 100644 --- a/SQLite.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,14).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,14).sql index 45eb9d3b1c2..205cceaecee 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,14).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,15).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,15).sql index 13662a8a991..714fef2d984 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,15).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,14).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,14).sql index e7237ee72e5..7c8eaf77848 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,14).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,15).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,15).sql index 47c028c9e61..9cda72b2a8f 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,15).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,14).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,14).sql index 79cc68e8023..709dfd7e88f 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,14).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,15).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,15).sql index 9b7f095d908..fe5369ffb47 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,15).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,14).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,14).sql index c1148b5f83c..9497b4c2eb0 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,14).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,15).sql b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,15).sql index 38e9a012bd4..fdfd96107eb 100644 --- a/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,15).sql +++ b/SQLite.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS.LinqService).sql index e0c8c0f5a74..3501c734c60 100644 --- a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS.LinqService).sql index 501e3fdfb74..47d697ccaa0 100644 --- a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SQLite.MS SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS.LinqService).sql index d57b0d23632..d64e8390e09 100644 --- a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS.LinqService).sql index 4f8829a0271..289ea26d8af 100644 --- a/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS.LinqService).sql index 5ef2dfcc44c..145024c7278 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS.LinqService).sql index d06e0cea95d..6878a0826a4 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS.LinqService).sql index cccd1d619b1..d8c9662daf8 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.MS SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS.LinqService).sql index df623375df2..837dd47c677 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS.LinqService).sql index df623375df2..480a0ce0ba5 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.MS SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS.LinqService).sql index f2e12c5531e..48ac1659980 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SQLite.MS SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS.LinqService).sql index e6f929a8746..bc92bb2a85c 100644 --- a/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS.LinqService).sql @@ -2,17 +2,21 @@ -- SQLite.MS SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..51029aaf6d2 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.MS.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SQLite.MS SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.MS SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.MS SQLite +DECLARE @Id -- Int32 +SET @Id = 1 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.MS SQLite +DECLARE @Id -- Int32 +SET @Id = 2 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.MS SQLite +DECLARE @Id -- Int32 +SET @Id = 3 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.MS SQLite +DECLARE @Id -- Int32 +SET @Id = 4 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SQLite.MS SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.MS SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS.LinqService).sql index cceacab6954..bdd9aac659c 100644 --- a/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS.LinqService).sql @@ -86,14 +86,14 @@ BeforeExecute -- SQLite.MS SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -103,7 +103,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.MS SQLite diff --git a/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS.LinqService).sql index e5bf04ea3d6..bfcebd7bb28 100644 --- a/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS.LinqService).sql @@ -89,8 +89,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..15b850cfc51 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..70119b4b0ee --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS.LinqService).sql index d38cdd03cc7..70119b4b0ee 100644 --- a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SQLite.MS SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS.LinqService).sql index f13bba99a32..c36466b4d57 100644 --- a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SQLite.MS SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..3c64db3e599 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..a1cdc206748 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..c36466b4d57 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..487fcf24a60 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..d38cdd03cc7 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.MS.LinqService).sql new file mode 100644 index 00000000000..f13bba99a32 --- /dev/null +++ b/SQLite.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,False).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,False).sql index 9a6f4fed27a..a4815fd81dc 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,False).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,True).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,True).sql index 9a6f4fed27a..a4815fd81dc 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,True).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,False).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,False).sql index 8bd11da5454..abe7f43c12f 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,False).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,True).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,True).sql index 8bd11da5454..abe7f43c12f 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,True).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS.LinqService,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS.LinqService).sql index 1e414be8ebe..0e5c2db8672 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS.LinqService).sql index d9a947eec16..7095c1c8593 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS.LinqService).sql b/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS.LinqService).sql index 869eec1cca3..b33a9c7d760 100644 --- a/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS.LinqService).sql +++ b/SQLite.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.MS/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS).sql b/SQLite.MS/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS).sql index 8e068482812..5672d4b01b0 100644 --- a/SQLite.MS/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/AbstractionTests/Tests.Linq.AbstractionTests.MappingWithoutAbstracts(SQLite.MS).sql @@ -2,14 +2,14 @@ -- SQLite.MS SQLite SELECT - [b].[ParentID], + [proj].[ParentID], [impl].[ParentID], [impl].[Value1] FROM - [Parent] [b] - INNER JOIN [Parent] [impl] ON [b].[ParentID] = [impl].[ParentID] + [Parent] [proj] + INNER JOIN [Parent] [impl] ON [proj].[ParentID] = [impl].[ParentID] WHERE - ([b].[ParentID] = 2 OR [b].[ParentID] = 3) + ([proj].[ParentID] = 2 OR [proj].[ParentID] = 3) ORDER BY - [b].[ParentID] + [proj].[ParentID] diff --git a/SQLite.MS/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS).sql b/SQLite.MS/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS).sql index de65ae0958f..090ce64e231 100644 --- a/SQLite.MS/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/ConvertExpressionTests/Tests.Linq.ConvertExpressionTests.LetTest11(SQLite.MS).sql @@ -3,29 +3,8 @@ SELECT CASE - WHEN ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) IS NULL - THEN 0 - ELSE ( - SELECT - [c_1].[ParentID] - FROM - [Child] [c_1] - WHERE - [c_1].[ParentID] > 0 - ORDER BY - [c_1].[ParentID] - LIMIT 1 - ) + WHEN [t1].[ParentID_1] IS NULL THEN 0 + ELSE [t1].[ParentID_1] END, ( SELECT @@ -50,7 +29,23 @@ SELECT LIMIT 1 ) FROM - [Parent] [p] + ( + SELECT + [p].[ParentID], + ( + SELECT + [c_1].[ParentID] + FROM + [Child] [c_1] + WHERE + [c_1].[ParentID] > 0 + ORDER BY + [c_1].[ParentID] + LIMIT 1 + ) as [ParentID_1] + FROM + [Parent] [p] + ) [t1] ORDER BY - [p].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS,False).sql b/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS,False).sql index 5385bbb20d7..f1f1dbeed60 100644 --- a/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS,False).sql +++ b/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SQLite.MS,False).sql @@ -34,22 +34,24 @@ BeforeExecute -- SQLite.MS SQLite SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = '000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = '000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SQLite.MS SQLite diff --git a/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS).sql b/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS).sql index 73ad67e1d2b..38a3f956a8a 100644 --- a/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SQLite.MS).sql @@ -67,10 +67,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SQLite.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS).sql b/SQLite.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS).sql index a84cd0830de..a29f00416a7 100644 --- a/SQLite.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SQLite.MS).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,1).sql b/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,1).sql index a66b06dd7cf..f95d2f337be 100644 --- a/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,1).sql +++ b/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,1).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,2).sql b/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,2).sql index 1ea3f810158..dd58531377c 100644 --- a/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,2).sql +++ b/SQLite.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SQLite.MS,2).sql @@ -9,13 +9,13 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT NULL [FirstName], NULL [PersonID] WHERE 1 = 0 UNION ALL VALUES ('Janet',@ID), ('Doe',@ID_1) - ) [n] ON [p].[PersonID] = [n].[PersonID] + ) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SQLite.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS).sql b/SQLite.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS).sql index 53f0e29f2d8..9ed668616a4 100644 --- a/SQLite.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SQLite.MS).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] || ' ' || [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,14).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,14).sql index 030d61ad02d..827a248e2bd 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,14).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,15).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,15).sql index 76f6ed2b7d2..c048ba502a7 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,15).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SQLite.MS,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,14).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,14).sql index 63dfb69f0d7..52afec43567 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,14).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,15).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,15).sql index 9acf37ee6ec..99a4c97210b 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,15).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SQLite.MS,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,14).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,14).sql index dec43fea93d..542f4ba1c95 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,14).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,15).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,15).sql index b471e8a4ffe..e6137c105aa 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,15).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SQLite.MS,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,14).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,14).sql index a45755bc21e..34fbd833eab 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,14).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,14).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,15).sql b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,15).sql index 1fffc48b3b8..9ff6fac8d2a 100644 --- a/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,15).sql +++ b/SQLite.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SQLite.MS,15).sql @@ -53,10 +53,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SQLite.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.MS).sql b/SQLite.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.MS).sql index 3d321948d7b..9aff042301a 100644 --- a/SQLite.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SQLite.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = 'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS).sql b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS).sql index e0c8c0f5a74..3501c734c60 100644 --- a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SQLite.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS).sql index 501e3fdfb74..47d697ccaa0 100644 --- a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SQLite.MS).sql @@ -2,13 +2,13 @@ -- SQLite.MS SQLite SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS).sql index d57b0d23632..d64e8390e09 100644 --- a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SQLite.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ([Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2) - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS).sql index 4f8829a0271..289ea26d8af 100644 --- a/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SQLite.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS).sql index bb27646e6da..752964324e8 100644 --- a/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SQLite.MS).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) LIMIT @take OFFSET @skip BeforeExecute @@ -97,13 +97,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS).sql index c312dfbe96a..bdf71312493 100644 --- a/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SQLite.MS).sql @@ -67,13 +67,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) LIMIT @take OFFSET @skip BeforeExecute diff --git a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS).sql index cccd1d619b1..d8c9662daf8 100644 --- a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SQLite.MS).sql @@ -2,11 +2,11 @@ -- SQLite.MS SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS).sql index df623375df2..837dd47c677 100644 --- a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SQLite.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS).sql index df623375df2..480a0ce0ba5 100644 --- a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SQLite.MS).sql @@ -2,11 +2,11 @@ -- SQLite.MS SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS).sql index f2e12c5531e..48ac1659980 100644 --- a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SQLite.MS).sql @@ -2,11 +2,11 @@ -- SQLite.MS SQLite SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS).sql b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS).sql index e6f929a8746..bc92bb2a85c 100644 --- a/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SQLite.MS).sql @@ -2,17 +2,21 @@ -- SQLite.MS SQLite SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.MS).sql b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.MS).sql new file mode 100644 index 00000000000..db90893b780 --- /dev/null +++ b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SQLite.MS).sql @@ -0,0 +1,65 @@ +BeforeExecute +-- SQLite.MS SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SQLite.MS SQLite + +CREATE TABLE IF NOT EXISTS [CoalesceNullableFields] +( + [Id] INTEGER NOT NULL, + [Nullable1] INTEGER NULL, + [Nullable2] INTEGER NULL, + [Nullable3] INTEGER NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SQLite.MS SQLite + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SQLite.MS SQLite + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SQLite.MS SQLite + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.MS).sql b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.MS).sql index f0a8486988c..dc03394dd31 100644 --- a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SQLite.MS).sql @@ -2,130 +2,130 @@ -- SQLite.MS SQLite SELECT - [t1].[ParentID_6], - [t1].[Value1], [t1].[ParentID], + [t1].[Value1], + [t1].[ParentID_1], [t1].[ChildID], [t1].[Any_1], [t1].[ChildID_1], - [t1].[ParentID_1], - [t1].[ChildID_2], [t1].[ParentID_2], - [t1].[ChildID_3], + [t1].[ChildID_2], [t1].[ParentID_3], - [t1].[ChildID_4], + [t1].[ChildID_3], [t1].[ParentID_4], + [t1].[ChildID_4], + [t1].[ParentID_5], [t1].[ChildID_5], - [t1].[ParentID_5] + [t1].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], + [p].[ParentID], + [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], [c1_1].[ChildID], + CASE + WHEN EXISTS( + SELECT + * + FROM + [Child] [c_1] + WHERE + [c_1].[ChildID] > 2 + ) + THEN 1 + ELSE 0 + END as [Any_1], ( SELECT - [c_1].[ChildID] - FROM - [Child] [c_1] - WHERE - [c_1].[ChildID] > 2 AND [c_1].[ParentID] >= [p].[ParentID] - LIMIT 1 - ) as [ChildID_1], - ( - SELECT - [c_2].[ParentID] + [c_2].[ChildID] FROM [Child] [c_2] WHERE [c_2].[ChildID] > 2 AND [c_2].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_1], + ) as [ChildID_1], ( SELECT - [c_3].[ChildID] + [c_3].[ParentID] FROM [Child] [c_3] WHERE - [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= 2 + [c_3].[ChildID] > 2 AND [c_3].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_2], + ) as [ParentID_2], ( SELECT - [c_4].[ParentID] + [c_4].[ChildID] FROM [Child] [c_4] WHERE [c_4].[ChildID] > 2 AND [c_4].[ParentID] >= 2 LIMIT 1 - ) as [ParentID_2], + ) as [ChildID_2], ( SELECT - [c_5].[ChildID] + [c_5].[ParentID] FROM [Child] [c_5] WHERE - [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= [p].[ParentID] + [c_5].[ChildID] > 2 AND [c_5].[ParentID] >= 2 LIMIT 1 - ) as [ChildID_3], + ) as [ParentID_3], ( SELECT - [c_6].[ParentID] + [c_6].[ChildID] FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 AND [c_6].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_3], + ) as [ChildID_3], ( SELECT - [c_7].[ChildID] + [c_7].[ParentID] FROM [Child] [c_7] WHERE [c_7].[ChildID] > 2 AND [c_7].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_4], + ) as [ParentID_4], ( SELECT - [c_8].[ParentID] + [c_8].[ChildID] FROM [Child] [c_8] WHERE [c_8].[ChildID] > 2 AND [c_8].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_4], + ) as [ChildID_4], ( SELECT - [c_9].[ChildID] + [c_9].[ParentID] FROM [Child] [c_9] WHERE [c_9].[ChildID] > 2 AND [c_9].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ChildID_5], + ) as [ParentID_5], ( SELECT - [c_10].[ParentID] + [c_10].[ChildID] FROM [Child] [c_10] WHERE [c_10].[ChildID] > 2 AND [c_10].[ParentID] >= [p].[ParentID] LIMIT 1 - ) as [ParentID_5], - [p].[ParentID] as [ParentID_6], - [p].[Value1], - CASE - WHEN EXISTS( - SELECT - * - FROM - [Child] [c_11] - WHERE - [c_11].[ChildID] > 2 - ) - THEN 1 - ELSE 0 - END as [Any_1] + ) as [ChildID_5], + ( + SELECT + [c_11].[ParentID] + FROM + [Child] [c_11] + WHERE + [c_11].[ChildID] > 2 AND [c_11].[ParentID] >= [p].[ParentID] + LIMIT 1 + ) as [ParentID_6] FROM [Parent] [p] LEFT JOIN ( @@ -138,5 +138,5 @@ FROM ) [c1_1] ON [c1_1].[ParentID] = [p].[ParentID] AND [c1_1].[rn] <= 1 ) [t1] ORDER BY - [t1].[ParentID_6] + [t1].[ParentID] diff --git a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS).sql b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS).sql index a178bff285f..b284d0be1c6 100644 --- a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestConditionalInProjection(SQLite.MS).sql @@ -55,14 +55,14 @@ BeforeExecute -- SQLite.MS SQLite SELECT - [m_1].[Id], + [t2].[Id], [c_1].[Id], [c_1].[Value], [t1].[Id], [t1].[Value_1] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t2] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t2].[Id] LEFT JOIN ( SELECT [sc].[Id], @@ -72,7 +72,7 @@ FROM LIMIT 1 ) [t1] ON 1=1 ORDER BY - [m_1].[Id] + [t2].[Id] BeforeExecute -- SQLite.MS SQLite diff --git a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS).sql b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS).sql index ee0ac3b3061..38fdfc897bd 100644 --- a/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.TestExpressionMethodInProjection(SQLite.MS).sql @@ -58,8 +58,8 @@ SELECT [c_1].[Id], [c_1].[Value] FROM - [MainEntityObject] [m_1] - LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [m_1].[Id] + [MainEntityObject] [t1] + LEFT JOIN [ChildEntityObject] [c_1] ON [c_1].[Id] = [t1].[Id] ORDER BY [c_1].[Id] DESC diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.MS).sql new file mode 100644 index 00000000000..15b850cfc51 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SQLite.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.MS).sql new file mode 100644 index 00000000000..70119b4b0ee --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SQLite.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS).sql index d38cdd03cc7..70119b4b0ee 100644 --- a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SQLite.MS).sql @@ -2,17 +2,10 @@ -- SQLite.MS SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS).sql index f13bba99a32..c36466b4d57 100644 --- a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS).sql +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SQLite.MS).sql @@ -2,14 +2,10 @@ -- SQLite.MS SQLite SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.MS).sql new file mode 100644 index 00000000000..3c64db3e599 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SQLite.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.MS).sql new file mode 100644 index 00000000000..a1cdc206748 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SQLite.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.MS).sql new file mode 100644 index 00000000000..c36466b4d57 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SQLite.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.MS).sql new file mode 100644 index 00000000000..487fcf24a60 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SQLite.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.MS).sql new file mode 100644 index 00000000000..d38cdd03cc7 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SQLite.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.MS).sql new file mode 100644 index 00000000000..f13bba99a32 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SQLite.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SQLite.MS SQLite + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SQLite.MS/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.MS).sql b/SQLite.MS/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.MS).sql index d96610dac07..52af59dfe30 100644 --- a/SQLite.MS/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.MS).sql +++ b/SQLite.MS/Tests/UserTests/Issue1760Tests/Tests.UserTests.Issue1760Tests.OriginalTest(SQLite.MS).sql @@ -81,21 +81,21 @@ DECLARE @id -- Int32 SET @id = 0 SELECT - [s_1].[TextCol], - [s_1].[b1], - [s_1].[b2], - [s_1].[b3] + [bt1].[textCol], + [t1].[b1], + [t1].[b2], + [t1].[b3] FROM - ( - SELECT - Coalesce([btbl].[col1], '') as [b1], - Coalesce([btbl].[col2], '') as [b2], - Coalesce([btbl].[col3], '') as [b3], - [bt1].[textCol] as [TextCol] - FROM - [table1] [s] - LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] - LEFT JOIN ( + [table1] [s] + LEFT JOIN [table2] [bt1] ON [s].[c_tb1l_Id] = [bt1].[id] + LEFT JOIN ( + SELECT + Coalesce([ctb].[Col3], 0) as [c1], + Coalesce([btbl].[col1], '') as [b1], + Coalesce([btbl].[col2], '') as [b2], + Coalesce([btbl].[col3], '') as [b3] + FROM + ( SELECT MAX([tbl3].[id]) as [maxCol], [tbl2].[col3] as [Col3] @@ -107,18 +107,18 @@ FROM [w].[commonTableId] = @id AND [tbl2].[col3] IS NOT NULL GROUP BY [tbl2].[col3] - ) [ctb] ON [bt1].[col3] = Coalesce([ctb].[Col3], 0) - LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] - LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] - LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) - WHERE - [s].[commonTableId] = @id - ) [s_1] + ) [ctb] + LEFT JOIN [table3] [tbl3_1] ON [ctb].[maxCol] = [tbl3_1].[id] + LEFT JOIN [b_table2] [btbl] ON [tbl3_1].[col] = [btbl].[id] + ) [t1] ON [bt1].[col3] = [t1].[c1] + LEFT JOIN [c_table2] [ctb2] ON ([bt1].[textCol] = [ctb2].[col1] OR [bt1].[textCol] IS NULL AND [ctb2].[col1] IS NULL) +WHERE + [s].[commonTableId] = @id GROUP BY - [s_1].[b1], - [s_1].[b2], - [s_1].[b3], - [s_1].[TextCol] + [t1].[b1], + [t1].[b2], + [t1].[b3], + [bt1].[textCol] BeforeExecute -- SQLite.MS SQLite diff --git a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,False).sql b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,False).sql index 9a6f4fed27a..a4815fd81dc 100644 --- a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,False).sql +++ b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,True).sql b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,True).sql index 9a6f4fed27a..a4815fd81dc 100644 --- a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,True).sql +++ b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_14(SQLite.MS,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[FirstName] || '1', NULL) IS NULL + [r].[FirstName] || '1' IS NULL diff --git a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,False).sql b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,False).sql index 8bd11da5454..abe7f43c12f 100644 --- a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,False).sql +++ b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,False).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,True).sql b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,True).sql index 8bd11da5454..abe7f43c12f 100644 --- a/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,True).sql +++ b/SQLite.MS/Tests/UserTests/Issue3148Tests/Tests.UserTests.Issue3148Tests.TestDefaultExpression_15(SQLite.MS,True).sql @@ -10,7 +10,7 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 BeforeExecute -- SQLite.MS SQLite @@ -24,5 +24,5 @@ SELECT FROM [Person] [r] WHERE - Coalesce([r].[PersonID] + 1, 0) = 0 + [r].[PersonID] + 1 = 0 diff --git a/SQLite.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.MS).sql b/SQLite.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.MS).sql index 9c2b8da2a77..1f66cf1c4f0 100644 --- a/SQLite.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.MS).sql +++ b/SQLite.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SQLite.MS).sql @@ -122,7 +122,7 @@ BeforeExecute -- SQLite.MS SQLite SELECT - [t5].[SUM_1], + [t5].[WithParentReference], [t5].[WithParentReferenceCustom1], [t5].[WithParentReferenceCustom2], [t5].[WithoutParentReference] @@ -153,7 +153,7 @@ FROM WHERE [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum(CASE @@ -235,7 +235,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t5] ORDER BY - Coalesce([t5].[SUM_1], 0), + Coalesce([t5].[WithParentReference], 0), Coalesce([t5].[WithParentReferenceCustom1], 0), Coalesce([t5].[WithParentReferenceCustom2], 0), Coalesce([t5].[WithoutParentReference], 0) DESC diff --git a/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS).sql b/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS).sql index 1e414be8ebe..0e5c2db8672 100644 --- a/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS).sql +++ b/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SQLite.MS).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,9 +26,9 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] LIMIT @take diff --git a/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS).sql b/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS).sql index d9a947eec16..7095c1c8593 100644 --- a/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS).sql +++ b/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SQLite.MS).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS).sql b/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS).sql index 869eec1cca3..b33a9c7d760 100644 --- a/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS).sql +++ b/SQLite.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SQLite.MS).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,8 +29,8 @@ FROM ORDER BY [c_2].[ParentID] LIMIT 10 OFFSET 10 - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] LIMIT @take diff --git a/SapHana.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc.LinqService).sql index 9d9087b611f..e584e95e758 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,1).sql b/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,1).sql index 6d4d0389a94..cd803c3fda2 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,1).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT 'Janet' AS "FirstName", ? AS "PersonID" FROM DUMMY UNION ALL - SELECT 'Doe', ? FROM DUMMY) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT 'Doe', ? FROM DUMMY) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,2).sql b/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,2).sql index 10d57bf1190..c807f7bfe87 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,2).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT 'Janet' AS "FirstName", ? AS "PersonID" FROM DUMMY UNION ALL - SELECT 'Doe', ? FROM DUMMY) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT 'Doe', ? FROM DUMMY) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc.LinqService).sql index 7f185dfeae8..3d5cbf9120e 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc.LinqService).sql index 116a3774027..002a764f3ad 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc.LinqService).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc.LinqService).sql index 311fd64dbfc..dd9a3e899fd 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc.LinqService).sql index a1791a5da56..43a15bb8c1e 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> ? - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql index 439b1c9759d..7df574ed0cd 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -19,7 +19,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> ? AND "right2"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql index da8d86eae2f..241e0ce153f 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql @@ -2,13 +2,13 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql index 49a363ee7f2..2135adb72dd 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" FULL JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql index 2a81d2d0758..f3b4b2d4804 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> ? AND "left2"."ParentID" <> ? - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql index bd042c698dc..e0377ddc4f3 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -19,7 +19,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> ? AND "right2"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql index e1d120dd655..90b8a248889 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc.LinqService).sql @@ -2,13 +2,13 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql index 6b9cb812141..3e2db13f7ad 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" RIGHT JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql index 3583a9d4769..9161da6d853 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc.LinqService).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> ? AND "left2"."ParentID" <> ? - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc.LinqService).sql index f3974097113..072085634f9 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") LIMIT ? OFFSET ? BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC LIMIT ? OFFSET ? BeforeExecute diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc.LinqService).sql index f1b7b2f0b02..5efbd5c890c 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc.LinqService).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(MOD("g_1"."OrderData1", 3)) + MAX(MOD("x"."OrderData1", 3)) LIMIT ? OFFSET ? BeforeExecute diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc.LinqService).sql index 07d51c23789..10bb4b17e78 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc.LinqService).sql @@ -2,11 +2,11 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - MOD("x"."ChildID", 2), - "x"."ChildID" DESC + MOD("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc.LinqService).sql index e42182a5b9e..804fa9c0c74 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - MOD("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + MOD("x"."ChildID", 2) diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc.LinqService).sql index e42182a5b9e..a9ac90c111a 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc.LinqService).sql @@ -2,11 +2,11 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - MOD("x"."ChildID", 2), - "x"."ChildID" + MOD("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc.LinqService).sql index fb946ffcc17..04f54f39a7b 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc.LinqService).sql @@ -2,11 +2,11 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - MOD("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + MOD("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc.LinqService).sql index d1ab1d8bab6..254ceb3f221 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc.LinqService).sql @@ -2,17 +2,21 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2"."ID", + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + "t1"."PersonID" as "ID", + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2"."flag" diff --git a/SapHana.Odbc.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..315069328c6 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SapHana.Odbc.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +DROP TABLE "CoalesceNullableFields" + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +CREATE COLUMN TABLE "CoalesceNullableFields" +( + "Id" Integer NOT NULL, + "Nullable1" Integer NULL, + "Nullable2" Integer NULL, + "Nullable3" Integer NULL, + + PRIMARY KEY ("Id") +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 1 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 2 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 3 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 4 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +DROP TABLE "CoalesceNullableFields" + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..ee4b0ba5f47 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SapHana.Odbc.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..b3cae1cbf31 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SapHana.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc.LinqService).sql index dfd2fcf80b7..b3cae1cbf31 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc.LinqService).sql @@ -2,17 +2,10 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc.LinqService).sql index 7ec414e5e3d..2414faebd61 100644 --- a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc.LinqService).sql @@ -2,14 +2,10 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..6316887d6d3 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SapHana.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..c031c594dfe --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SapHana.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..2414faebd61 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SapHana.Odbc.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..954dc83bd38 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SapHana.Odbc.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..dfd2fcf80b7 --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SapHana.Odbc.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SapHana.Odbc.LinqService).sql new file mode 100644 index 00000000000..7ec414e5e3d --- /dev/null +++ b/SapHana.Odbc.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SapHana.Odbc.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc.LinqService).sql index a3c3e24e3e7..c00fd47099e 100644 --- a/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" LIMIT 10 - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" LIMIT ? diff --git a/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc.LinqService).sql b/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc.LinqService).sql index f7726546991..7d497b06113 100644 --- a/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc.LinqService).sql +++ b/SapHana.Odbc.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" LIMIT 10 OFFSET 10 - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" LIMIT ? diff --git a/SapHana.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc).sql index 9d9087b611f..e584e95e758 100644 --- a/SapHana.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SapHana.Odbc).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - "a_Children"."ParentID", - "a_Children"."ChildID" + "a_Children"."ChildID", + "a_Children"."ParentID" FROM "Child" "a_Children" WHERE diff --git a/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,1).sql b/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,1).sql index 6d4d0389a94..cd803c3fda2 100644 --- a/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,1).sql +++ b/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,1).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT 'Janet' AS "FirstName", ? AS "PersonID" FROM DUMMY UNION ALL - SELECT 'Doe', ? FROM DUMMY) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT 'Doe', ? FROM DUMMY) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,2).sql b/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,2).sql index 10d57bf1190..c807f7bfe87 100644 --- a/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,2).sql +++ b/SapHana.Odbc/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SapHana.Odbc,2).sql @@ -9,11 +9,11 @@ SELECT "n"."FirstName", "n"."PersonID" FROM - "Person" "p" + "Person" "t1" INNER JOIN ( SELECT 'Janet' AS "FirstName", ? AS "PersonID" FROM DUMMY UNION ALL - SELECT 'Doe', ? FROM DUMMY) "n" ON "p"."PersonID" = "n"."PersonID" + SELECT 'Doe', ? FROM DUMMY) "n" ON "t1"."PersonID" = "n"."PersonID" ORDER BY "n"."PersonID" diff --git a/SapHana.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc).sql index 7f185dfeae8..3d5cbf9120e 100644 --- a/SapHana.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SapHana.Odbc).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT "t1"."Id", "t1"."FirstName", - "t1"."LastName", - "t1"."FirstName" || ' ' || "t1"."LastName" + "t1"."LastName" FROM "Issue2434Table" "t1" ORDER BY diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc).sql index 116a3774027..002a764f3ad 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SapHana.Odbc).sql @@ -4,8 +4,8 @@ SELECT "a_2"."ParentID", "a_2"."Value1", - "z_1"."ParentID", - "z_1"."Value1", + "z_2"."ParentID", + "z_2"."Value1", "y"."ParentID", "y"."Value1", "a"."ParentID", @@ -19,6 +19,13 @@ FROM LEFT JOIN "Parent" "y" ON "a_2"."ParentID" = "y"."ParentID" LEFT JOIN "Parent" "a" ON "a_2"."ParentID" = "a"."ParentID" LEFT JOIN "Parent" "z" ON "a_2"."ParentID" = "z"."ParentID" - LEFT JOIN "Parent" "z_1" ON "a_2"."ParentID" = Coalesce("z_1"."Value1", 1) + LEFT JOIN ( + SELECT + "z_1"."ParentID", + "z_1"."Value1", + Coalesce("z_1"."Value1", 1) as "c1" + FROM + "Parent" "z_1" + ) "z_2" ON "a_2"."ParentID" = "z_2"."c1" LEFT JOIN "Parent" "a_1" ON "a_2"."ParentID" = "a_1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc).sql index 311fd64dbfc..dd9a3e899fd 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SapHana.Odbc).sql @@ -6,7 +6,7 @@ DECLARE @id2 -- Int32 SET @id2 = 2 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "right_2" ON "right_2"."ParentID" = "left_1"."ParentID" + ) "right_2" ON "right_2"."ParentID" = "t1"."ParentID" ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc).sql index a1791a5da56..43a15bb8c1e 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SapHana.Odbc).sql @@ -6,7 +6,7 @@ DECLARE @id2 -- Int32 SET @id2 = 2 SELECT - "left_2"."left_1", + "t2"."left_1", "t1"."ParentID" FROM ( @@ -16,7 +16,7 @@ FROM "Parent" "left_1" WHERE "left_1"."ParentID" <> ? - ) "left_2" + ) "t2" FULL JOIN ( SELECT "right_1"."ParentID" @@ -24,7 +24,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "t1" ON "t1"."ParentID" = "left_2"."left_1" + ) "t1" ON "t1"."ParentID" = "t2"."left_1" ORDER BY - "left_2"."left_1" + "t2"."left_1" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql index 439b1c9759d..7df574ed0cd 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -19,7 +19,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> ? AND "right2"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql index da8d86eae2f..241e0ce153f 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql @@ -2,13 +2,13 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" FULL JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql index 49a363ee7f2..2135adb72dd 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" FULL JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql index 2a81d2d0758..f3b4b2d4804 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> ? AND "left2"."ParentID" <> ? - ) "left_2" + ) "t1" FULL JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql index bd042c698dc..e0377ddc4f3 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SapHana.Odbc).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -19,7 +19,7 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2 WHERE "right_1"."ParentID" <> ? AND "right2"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_1"."Value1" OR "right_2"."c1" IS NULL AND "left_1"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql index e1d120dd655..90b8a248889 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SapHana.Odbc).sql @@ -2,13 +2,13 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM - "Parent" "left_1" + "Parent" "t1" RIGHT JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql index 6b9cb812141..3e2db13f7ad 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SapHana.Odbc).sql @@ -4,7 +4,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_1"."ParentID", + "t1"."ParentID", "right_1"."ParentID" FROM ( @@ -15,10 +15,10 @@ FROM "Parent" "p" WHERE "p"."ParentID" <> ? - ) "left_1" + ) "t1" RIGHT JOIN ("Parent" "right_1" INNER JOIN "Parent" "right2" ON "right_1"."Value1" = "right2"."Value1" + 2) - ON ("right_1"."Value1" + 2 = "left_1"."Value1" OR "right_1"."Value1" IS NULL AND "left_1"."Value1" IS NULL) + ON ("right_1"."Value1" + 2 = "t1"."Value1" OR "right_1"."Value1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_1"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql index 3583a9d4769..9161da6d853 100644 --- a/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SapHana.Odbc).sql @@ -8,7 +8,7 @@ DECLARE @id1 -- Int32 SET @id1 = 1 SELECT - "left_2"."ParentID", + "t1"."ParentID", "right_2"."ParentID" FROM ( @@ -20,7 +20,7 @@ FROM INNER JOIN "Parent" "left2" ON "left_1"."Value1" = "left2"."Value1" + 2 WHERE "left_1"."ParentID" <> ? AND "left2"."ParentID" <> ? - ) "left_2" + ) "t1" RIGHT JOIN ( SELECT "right_1"."ParentID", @@ -29,7 +29,7 @@ FROM "Parent" "right_1" WHERE "right_1"."ParentID" <> ? - ) "right_2" ON ("right_2"."c1" = "left_2"."Value1" OR "right_2"."c1" IS NULL AND "left_2"."Value1" IS NULL) + ) "right_2" ON ("right_2"."c1" = "t1"."Value1" OR "right_2"."c1" IS NULL AND "t1"."Value1" IS NULL) ORDER BY - "left_2"."ParentID" + "t1"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc).sql index f3974097113..072085634f9 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SapHana.Odbc).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX("g_1"."OrderData1") + MAX("x"."OrderData1") LIMIT ? OFFSET ? BeforeExecute @@ -535,13 +535,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MIN("g_1"."OrderData1") DESC + MIN("x"."OrderData1") DESC LIMIT ? OFFSET ? BeforeExecute diff --git a/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc).sql index f1b7b2f0b02..5efbd5c890c 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SapHana.Odbc).sql @@ -505,13 +505,13 @@ DECLARE @skip -- Int32 SET @skip = 0 SELECT - "g_1"."DuplicateData" + "x"."DuplicateData" FROM - "OrderByDistinctData" "g_1" + "OrderByDistinctData" "x" GROUP BY - "g_1"."DuplicateData" + "x"."DuplicateData" ORDER BY - MAX(MOD("g_1"."OrderData1", 3)) + MAX(MOD("x"."OrderData1", 3)) LIMIT ? OFFSET ? BeforeExecute diff --git a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc).sql index 07d51c23789..10bb4b17e78 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SapHana.Odbc).sql @@ -2,11 +2,11 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - MOD("x"."ChildID", 2), - "x"."ChildID" DESC + MOD("ch"."ChildID", 2), + "ch"."ChildID" DESC diff --git a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc).sql index e42182a5b9e..804fa9c0c74 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SapHana.Odbc).sql @@ -7,6 +7,6 @@ SELECT FROM "Child" "x" ORDER BY - MOD("x"."ChildID", 2), - "x"."ChildID" + "x"."ChildID", + MOD("x"."ChildID", 2) diff --git a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc).sql index e42182a5b9e..a9ac90c111a 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SapHana.Odbc).sql @@ -2,11 +2,11 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - MOD("x"."ChildID", 2), - "x"."ChildID" + MOD("ch"."ChildID", 2), + "ch"."ChildID" diff --git a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc).sql index fb946ffcc17..04f54f39a7b 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SapHana.Odbc).sql @@ -2,11 +2,11 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "x"."ParentID", - "x"."ChildID" + "ch"."ParentID", + "ch"."ChildID" FROM - "Child" "x" + "Child" "ch" ORDER BY - MOD("x"."ChildID", 2) DESC, - "x"."ChildID" DESC + MOD("ch"."ChildID", 2) DESC, + "ch"."ChildID" DESC diff --git a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc).sql index d1ab1d8bab6..254ceb3f221 100644 --- a/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SapHana.Odbc).sql @@ -2,17 +2,21 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "t1"."PersonID", - "t1"."LastName", - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2"."ID", + "t2"."LastName", + "t2"."flag" FROM - "Person" "t1" + ( + SELECT + CASE + WHEN "t1"."PersonID" IN (1, 3) THEN 1 + ELSE 0 + END as "flag", + "t1"."PersonID" as "ID", + "t1"."LastName" + FROM + "Person" "t1" + ) "t2" ORDER BY - CASE - WHEN "t1"."PersonID" IN (1, 3) THEN 1 - ELSE 0 - END + "t2"."flag" diff --git a/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SapHana.Odbc).sql new file mode 100644 index 00000000000..315069328c6 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SapHana.Odbc).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +DROP TABLE "CoalesceNullableFields" + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +CREATE COLUMN TABLE "CoalesceNullableFields" +( + "Id" Integer NOT NULL, + "Nullable1" Integer NULL, + "Nullable2" Integer NULL, + "Nullable3" Integer NULL, + + PRIMARY KEY ("Id") +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 1 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 2 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 3 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = 30 + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc +DECLARE @Id -- Int32 +SET @Id = 4 +DECLARE @Nullable1 -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 -- Int32 +SET @Nullable3 = NULL + +INSERT INTO "CoalesceNullableFields" +( + "Id", + "Nullable1", + "Nullable2", + "Nullable3" +) +VALUES +( + ?, + ?, + ?, + ? +) + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable1", "t"."Nullable3", "t"."Id"), + Coalesce("t"."Nullable2", "t"."Nullable3", "t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable1", "t"."Nullable2", "t"."Id"), + Coalesce("t"."Nullable3", "t"."Nullable2", "t"."Nullable1", "t"."Id"), + "t"."Id", + Coalesce("t"."Nullable1", "t"."Id"), + Coalesce("t"."Nullable1", "t"."Nullable2", "t"."Id") +FROM + "CoalesceNullableFields" "t" + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t1"."Id", + "t1"."Nullable1", + "t1"."Nullable2", + "t1"."Nullable3" +FROM + "CoalesceNullableFields" "t1" + +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +DROP TABLE "CoalesceNullableFields" + diff --git a/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SapHana.Odbc).sql index 6802130afb6..50ea6b06658 100644 --- a/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SapHana.Odbc).sql @@ -2,38 +2,28 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "t6"."ParentID_6", - "t6"."Value1", "t6"."ParentID", + "t6"."Value1", + "t6"."ParentID_1", "t6"."ChildID", "t6"."Any_1", "t6"."ChildID_1", - "t6"."ParentID_1", - "t6"."ChildID_2", "t6"."ParentID_2", - "t6"."ChildID_3", + "t6"."ChildID_2", "t6"."ParentID_3", - "t6"."ChildID_4", + "t6"."ChildID_3", "t6"."ParentID_4", + "t6"."ChildID_4", + "t6"."ParentID_5", "t6"."ChildID_5", - "t6"."ParentID_5" + "t6"."ParentID_6" FROM ( SELECT DISTINCT - "c1_1"."ParentID", - "c1_1"."ChildID", - "t1"."ChildID" as "ChildID_1", - "t1"."ParentID" as "ParentID_1", - "t2"."ChildID" as "ChildID_2", - "t2"."ParentID" as "ParentID_2", - "t3"."ChildID" as "ChildID_3", - "t3"."ParentID" as "ParentID_3", - "t4"."ChildID" as "ChildID_4", - "t4"."ParentID" as "ParentID_4", - "t5"."ChildID" as "ChildID_5", - "t5"."ParentID" as "ParentID_5", - "p"."ParentID" as "ParentID_6", + "p"."ParentID", "p"."Value1", + "c1_1"."ParentID" as "ParentID_1", + "c1_1"."ChildID", CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as "Any_1" + END as "Any_1", + "t1"."ChildID" as "ChildID_1", + "t1"."ParentID" as "ParentID_2", + "t2"."ChildID" as "ChildID_2", + "t2"."ParentID" as "ParentID_3", + "t3"."ChildID" as "ChildID_3", + "t3"."ParentID" as "ParentID_4", + "t4"."ChildID" as "ChildID_4", + "t4"."ParentID" as "ParentID_5", + "t5"."ChildID" as "ChildID_5", + "t5"."ParentID" as "ParentID_6" FROM "Parent" "p" LEFT JOIN LATERAL ( @@ -110,5 +110,5 @@ FROM ) "t5" ON 1=1 ) "t6" ORDER BY - "t6"."ParentID_6" + "t6"."ParentID" diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SapHana.Odbc).sql new file mode 100644 index 00000000000..ee4b0ba5f47 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SapHana.Odbc).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND Coalesce("p"."MiddleName", 'None') = 'None' AND + "p"."FirstName" = 'John' + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SapHana.Odbc).sql new file mode 100644 index 00000000000..b3cae1cbf31 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SapHana.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" = 1 + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc).sql index dfd2fcf80b7..b3cae1cbf31 100644 --- a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SapHana.Odbc).sql @@ -2,17 +2,10 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND - "p"."MiddleName" IS NULL AND - "p"."MiddleName" IS NULL AND - "p"."FirstName" IS NOT NULL AND - "p"."FirstName" IS NOT NULL + "p"."ParentID" = 1 diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc).sql index 7ec414e5e3d..2414faebd61 100644 --- a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SapHana.Odbc).sql @@ -2,14 +2,10 @@ -- SapHana.Odbc SapHanaOdbc SELECT - "p"."FirstName", - "p"."PersonID", - "p"."LastName", - "p"."MiddleName", - "p"."Gender" + "p"."ParentID", + "p"."Value1" FROM - "Person" "p" + "Parent" "p" WHERE - "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND - NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + "p"."ParentID" <> 1 diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SapHana.Odbc).sql new file mode 100644 index 00000000000..6316887d6d3 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SapHana.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."Value1" = 1 + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SapHana.Odbc).sql new file mode 100644 index 00000000000..c031c594dfe --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SapHana.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + ("p"."Value1" <> 1 OR "p"."Value1" IS NULL) + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SapHana.Odbc).sql new file mode 100644 index 00000000000..2414faebd61 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SapHana.Odbc).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."ParentID", + "p"."Value1" +FROM + "Parent" "p" +WHERE + "p"."ParentID" <> 1 + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SapHana.Odbc).sql new file mode 100644 index 00000000000..954dc83bd38 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SapHana.Odbc).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SapHana.Odbc).sql new file mode 100644 index 00000000000..dfd2fcf80b7 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SapHana.Odbc).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND + "p"."MiddleName" IS NULL AND + "p"."MiddleName" IS NULL AND + "p"."FirstName" IS NOT NULL AND + "p"."FirstName" IS NOT NULL + diff --git a/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SapHana.Odbc).sql new file mode 100644 index 00000000000..7ec414e5e3d --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SapHana.Odbc).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SapHana.Odbc SapHanaOdbc + +SELECT + "p"."FirstName", + "p"."PersonID", + "p"."LastName", + "p"."MiddleName", + "p"."Gender" +FROM + "Person" "p" +WHERE + "p"."PersonID" = 1 AND NOT ("p"."MiddleName" IS NOT NULL OR "p"."PersonID" = 2 OR "p"."MiddleName" IS NOT NULL) AND + NOT ("p"."FirstName" IS NULL OR "p"."PersonID" = 2 OR "p"."FirstName" IS NULL) + diff --git a/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc).sql b/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc).sql index a3c3e24e3e7..c00fd47099e 100644 --- a/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SapHana.Odbc).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" LIMIT 10 - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" LIMIT ? diff --git a/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc).sql b/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc).sql index f7726546991..7d497b06113 100644 --- a/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc).sql +++ b/SapHana.Odbc/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SapHana.Odbc).sql @@ -4,10 +4,10 @@ DECLARE @take -- Int32 SET @take = 10 SELECT - "x"."ParentID", + "t3"."ParentID", "t2"."ChildID" FROM - "Parent" "x" + "Parent" "t3" INNER JOIN ( SELECT "c_2"."ParentID", @@ -29,8 +29,8 @@ FROM ORDER BY "c_2"."ParentID" LIMIT 10 OFFSET 10 - ) "t2" ON "t2"."ParentID" = "x"."ParentID" + ) "t2" ON "t2"."ParentID" = "t3"."ParentID" ORDER BY - "x"."ParentID" + "t3"."ParentID" LIMIT ? diff --git a/SqlCe.LinqService/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe.LinqService).sql index 7174c8c89be..182bf55668f 100644 --- a/SqlCe.LinqService/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe.LinqService).sql @@ -152,7 +152,7 @@ SELECT CASE WHEN [a_SubData].[Id] IS NULL THEN NULL ELSE [t1].[Reason] - END as [c1] + END as [Reason] FROM [Data] [i] LEFT JOIN [SubData1] [a_SubData] ON [i].[Id] = [a_SubData].[Id] diff --git a/SqlCe.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe.LinqService).sql index dc20903118b..1685fe2ad5a 100644 --- a/SqlCe.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,1).sql b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,1).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,1).sql +++ b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,1).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,2).sql b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,2).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,2).sql +++ b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe.LinqService,2).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,1).sql b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,1).sql index d7cbff8e945..e6e04f8fc55 100644 --- a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,1).sql +++ b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] as [ID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,2).sql b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,2).sql index 586a3d6be2b..0f31de18b6b 100644 --- a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,2).sql +++ b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] as [ID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,1).sql b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,1).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,1).sql +++ b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,1).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,2).sql b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,2).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,2).sql +++ b/SqlCe.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe.LinqService,2).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe.LinqService).sql index 4c3f458ad45..a05b99aa674 100644 --- a/SqlCe.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe.LinqService).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] as [FullName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,14).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,14).sql index 145796a7122..fbac5b66c0f 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,14).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,15).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,15).sql index 27ce7bff776..011fa0857ee 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,15).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,14).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,14).sql index ee53a19b318..148d50b3b71 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,14).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,15).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,15).sql index 819aa7f3d9e..dd3ed90cded 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,15).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,14).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,14).sql index 3ac7d7cc26e..d369ce6bef1 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,14).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,15).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,15).sql index dc62637c82e..bdf89b8d93e 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,15).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,14).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,14).sql index a6989a88286..d80d5aeaa54 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,14).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,14).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,15).sql b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,15).sql index a45bf251069..f1161f414c6 100644 --- a/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,15).sql +++ b/SqlCe.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe.LinqService,15).sql @@ -383,10 +383,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe.LinqService).sql index 6e18b8ebaff..351d6f9b9c9 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID] as [ParentID_1], - [z_1].[Value1] as [Value1_1], + [z_2].[ParentID] as [ParentID_1], + [z_2].[Value1] as [Value1_1], [y].[ParentID] as [ParentID_2], [y].[Value1] as [Value1_2], [a].[ParentID] as [ParentID_3], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe.LinqService).sql index e905cfc5c91..14f2eda43cd 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe.LinqService).sql @@ -6,8 +6,8 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID] as [Left_1], - [right_2].[ParentID] + [t1].[ParentID] as [Left_1], + [right_2].[ParentID] as [Right_1] FROM ( SELECT @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe.LinqService).sql index e96cde05cff..555eb6e2362 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe.LinqService).sql @@ -2,13 +2,13 @@ -- SqlCe SELECT - [left_1].[ParentID] as [Left_1], - [right_1].[ParentID] + [t1].[ParentID] as [Left_1], + [right_1].[ParentID] as [Right_1] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe.LinqService).sql index 4c7bc4b764e..3af05836bd4 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe.LinqService).sql @@ -4,8 +4,8 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID] as [Left_1], - [right_1].[ParentID] + [t1].[ParentID] as [Left_1], + [right_1].[ParentID] as [Right_1] FROM ( SELECT @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe.LinqService).sql index 1ce0c5af826..1ddb5f97ec3 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe.LinqService).sql @@ -6,8 +6,8 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID] as [Left_1], - [right_2].[ParentID] + [t1].[ParentID] as [Left_1], + [right_2].[ParentID] as [Right_1] FROM ( SELECT @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe.LinqService).sql index cdca23ec9e4..318a0c1af82 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe.LinqService).sql @@ -3,7 +3,7 @@ SELECT [left_1].[ParentID] as [Left_1], - [right_1].[ParentID] + [right_1].[ParentID] as [Right_1] FROM [Parent] [left_1] INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 diff --git a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe.LinqService).sql index d3d42d7daa6..4b6ecc6e958 100644 --- a/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe.LinqService).sql @@ -5,7 +5,7 @@ SET @id1 = 1 SELECT [left_1].[ParentID] as [Left_1], - [right_2].[ParentID] + [right_2].[ParentID] as [Right_1] FROM [Parent] [left_1] INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 diff --git a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe.LinqService).sql index 00911080aa9..1c50fb02418 100644 --- a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe.LinqService).sql @@ -2,11 +2,11 @@ -- SqlCe SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe.LinqService).sql index ab4d9a42e5a..e7b6d5715c9 100644 --- a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe.LinqService).sql index ab4d9a42e5a..3f961b6392b 100644 --- a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe.LinqService).sql @@ -2,11 +2,11 @@ -- SqlCe SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe.LinqService).sql index 22c21942a3d..34508f523fb 100644 --- a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe.LinqService).sql @@ -2,11 +2,11 @@ -- SqlCe SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe.LinqService).sql index b65866f6dd9..21e1a1362d6 100644 --- a/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe.LinqService).sql @@ -2,17 +2,21 @@ -- SqlCe SELECT - [t1].[PersonID] as [ID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END as [flag] + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlCe.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlCe.LinqService).sql new file mode 100644 index 00000000000..1dc8f2688e3 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlCe.LinqService).sql @@ -0,0 +1,153 @@ +BeforeExecute +-- SqlCe + +DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlCe + +CREATE TABLE [CoalesceNullableFields] +( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SqlCe +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlCe +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlCe +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlCe +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlCe + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]) as [c1], + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]) as [c2], + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]) as [c3], + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]) as [c4], + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]) as [c5], + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]) as [c6], + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) as [c7] +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlCe + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlCe + +DROP TABLE [CoalesceNullableFields] + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlCe.LinqService).sql new file mode 100644 index 00000000000..22e2ca7fb5e --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlCe.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlCe.LinqService).sql new file mode 100644 index 00000000000..b1ba5f5c619 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlCe.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe.LinqService).sql index 45caa1ae438..b1ba5f5c619 100644 --- a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe.LinqService).sql @@ -2,17 +2,10 @@ -- SqlCe SELECT - [p].[FirstName], - [p].[PersonID] as [ID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe.LinqService).sql index 55f96bdffa4..d4894e444c1 100644 --- a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe.LinqService).sql @@ -2,14 +2,10 @@ -- SqlCe SELECT - [p].[FirstName], - [p].[PersonID] as [ID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlCe.LinqService).sql new file mode 100644 index 00000000000..aea9f0691d7 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlCe.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlCe.LinqService).sql new file mode 100644 index 00000000000..373b97ba943 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlCe.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlCe.LinqService).sql new file mode 100644 index 00000000000..d4894e444c1 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlCe.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlCe.LinqService).sql new file mode 100644 index 00000000000..74868e13c6f --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlCe.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlCe.LinqService).sql new file mode 100644 index 00000000000..45caa1ae438 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlCe.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlCe.LinqService).sql new file mode 100644 index 00000000000..55f96bdffa4 --- /dev/null +++ b/SqlCe.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlCe.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe.LinqService).sql index 9a1da9c769c..a116c853051 100644 --- a/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe.LinqService).sql index 23a4349c3e2..0d4539aed42 100644 --- a/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe.LinqService).sql b/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe.LinqService).sql index e51b6ee5005..6ad869892f2 100644 --- a/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe.LinqService).sql +++ b/SqlCe.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlCe/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe).sql b/SqlCe/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe).sql index 99fabff8ae6..88d60236753 100644 --- a/SqlCe/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe).sql +++ b/SqlCe/Tests/Linq/AssociationTests/Tests.Linq.AssociationTests.Issue3557Case1(SqlCe).sql @@ -78,7 +78,7 @@ SELECT CASE WHEN [a_SubData].[Id] IS NULL THEN NULL ELSE [t1].[Reason] - END as [c1] + END as [Reason] FROM [Data] [i] LEFT JOIN [SubData1] [a_SubData] ON [i].[Id] = [a_SubData].[Id] diff --git a/SqlCe/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe).sql b/SqlCe/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe).sql index dc20903118b..1685fe2ad5a 100644 --- a/SqlCe/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe).sql +++ b/SqlCe/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlCe).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,1).sql b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,1).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,1).sql +++ b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,1).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,2).sql b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,2).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,2).sql +++ b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ConstantProjection(SqlCe,2).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,1).sql b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,1).sql index d7cbff8e945..e6e04f8fc55 100644 --- a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,1).sql +++ b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] as [ID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,2).sql b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,2).sql index 586a3d6be2b..0f31de18b6b 100644 --- a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,2).sql +++ b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlCe,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] as [ID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe' AS [FirstName], @ID_1 AS [PersonID]) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,1).sql b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,1).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,1).sql +++ b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,1).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,2).sql b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,2).sql index 703f3721d6a..1e9bd3db0a3 100644 --- a/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,2).sql +++ b/SqlCe/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.NullConstantProjection(SqlCe,2).sql @@ -2,7 +2,7 @@ -- SqlCe SELECT - [p].[PersonID] as [Id], + [p].[PersonID] as [ID], [p].[FirstName], [p].[LastName], [p].[MiddleName], diff --git a/SqlCe/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe).sql b/SqlCe/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe).sql index 4c3f458ad45..a05b99aa674 100644 --- a/SqlCe/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe).sql +++ b/SqlCe/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlCe).sql @@ -19,8 +19,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] as [FullName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,14).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,14).sql index bca98afbd83..f87f97989a4 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,14).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,14).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,15).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,15).sql index 0b056258947..f953c295edd 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,15).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlCe,15).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,14).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,14).sql index dd0fea9797c..ebedaa31bd6 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,14).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,14).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,15).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,15).sql index a0150b60503..dc126bf6c2f 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,15).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlCe,15).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,14).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,14).sql index c3dd7d0b727..0c24af7098c 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,14).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,14).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,15).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,15).sql index 9e18740ef52..feb93b298ff 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,15).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlCe,15).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,14).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,14).sql index 3ec5d87166a..5e1bafc0262 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,14).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,14).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,15).sql b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,15).sql index c9d4c92b91a..c9c62f5dae3 100644 --- a/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,15).sql +++ b/SqlCe/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlCe,15).sql @@ -52,10 +52,10 @@ SELECT [s].[value] as [Value_1], [s].[id] as [Id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe).sql index 6e18b8ebaff..351d6f9b9c9 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlCe).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID] as [ParentID_1], - [z_1].[Value1] as [Value1_1], + [z_2].[ParentID] as [ParentID_1], + [z_2].[Value1] as [Value1_1], [y].[ParentID] as [ParentID_2], [y].[Value1] as [Value1_2], [a].[ParentID] as [ParentID_3], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe).sql index e905cfc5c91..14f2eda43cd 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlCe).sql @@ -6,8 +6,8 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID] as [Left_1], - [right_2].[ParentID] + [t1].[ParentID] as [Left_1], + [right_2].[ParentID] as [Right_1] FROM ( SELECT @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe).sql index e96cde05cff..555eb6e2362 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlCe).sql @@ -2,13 +2,13 @@ -- SqlCe SELECT - [left_1].[ParentID] as [Left_1], - [right_1].[ParentID] + [t1].[ParentID] as [Left_1], + [right_1].[ParentID] as [Right_1] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe).sql index 4c7bc4b764e..3af05836bd4 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlCe).sql @@ -4,8 +4,8 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID] as [Left_1], - [right_1].[ParentID] + [t1].[ParentID] as [Left_1], + [right_1].[ParentID] as [Right_1] FROM ( SELECT @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe).sql index 1ce0c5af826..1ddb5f97ec3 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlCe).sql @@ -6,8 +6,8 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID] as [Left_1], - [right_2].[ParentID] + [t1].[ParentID] as [Left_1], + [right_2].[ParentID] as [Right_1] FROM ( SELECT @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe).sql index cdca23ec9e4..318a0c1af82 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutAllConditions(SqlCe).sql @@ -3,7 +3,7 @@ SELECT [left_1].[ParentID] as [Left_1], - [right_1].[ParentID] + [right_1].[ParentID] as [Right_1] FROM [Parent] [left_1] INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 diff --git a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe).sql b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe).sql index d3d42d7daa6..4b6ecc6e958 100644 --- a/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe).sql +++ b/SqlCe/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithoutConditions(SqlCe).sql @@ -5,7 +5,7 @@ SET @id1 = 1 SELECT [left_1].[ParentID] as [Left_1], - [right_2].[ParentID] + [right_2].[ParentID] as [Right_1] FROM [Parent] [left_1] INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 diff --git a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe).sql b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe).sql index 00911080aa9..1c50fb02418 100644 --- a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe).sql +++ b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlCe).sql @@ -2,11 +2,11 @@ -- SqlCe SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe).sql b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe).sql index ab4d9a42e5a..e7b6d5715c9 100644 --- a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe).sql +++ b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlCe).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe).sql b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe).sql index ab4d9a42e5a..3f961b6392b 100644 --- a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe).sql +++ b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlCe).sql @@ -2,11 +2,11 @@ -- SqlCe SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe).sql b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe).sql index 22c21942a3d..34508f523fb 100644 --- a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe).sql +++ b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlCe).sql @@ -2,11 +2,11 @@ -- SqlCe SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe).sql b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe).sql index b65866f6dd9..21e1a1362d6 100644 --- a/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe).sql +++ b/SqlCe/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlCe).sql @@ -2,17 +2,21 @@ -- SqlCe SELECT - [t1].[PersonID] as [ID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END as [flag] + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlCe/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlCe).sql b/SqlCe/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlCe).sql new file mode 100644 index 00000000000..d93580d8b9e --- /dev/null +++ b/SqlCe/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlCe).sql @@ -0,0 +1,64 @@ +BeforeExecute +-- SqlCe + +DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlCe + +CREATE TABLE [CoalesceNullableFields] +( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY ([Id]) +) + +BeforeExecute +-- SqlCe + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +SELECT 1,10,NULL,NULL UNION ALL +SELECT 2,NULL,20,NULL UNION ALL +SELECT 3,NULL,NULL,30 UNION ALL +SELECT 4,NULL,NULL,NULL + +BeforeExecute +-- SqlCe + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]) as [c1], + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]) as [c2], + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]) as [c3], + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]) as [c4], + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]) as [c5], + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]) as [c6], + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) as [c7] +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlCe + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlCe + +DROP TABLE [CoalesceNullableFields] + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlCe).sql new file mode 100644 index 00000000000..22e2ca7fb5e --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlCe).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlCe).sql new file mode 100644 index 00000000000..b1ba5f5c619 --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlCe).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe).sql index 45caa1ae438..b1ba5f5c619 100644 --- a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe).sql +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlCe).sql @@ -2,17 +2,10 @@ -- SqlCe SELECT - [p].[FirstName], - [p].[PersonID] as [ID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe).sql index 55f96bdffa4..d4894e444c1 100644 --- a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe).sql +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlCe).sql @@ -2,14 +2,10 @@ -- SqlCe SELECT - [p].[FirstName], - [p].[PersonID] as [ID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlCe).sql new file mode 100644 index 00000000000..aea9f0691d7 --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlCe).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlCe).sql new file mode 100644 index 00000000000..373b97ba943 --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlCe).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlCe).sql new file mode 100644 index 00000000000..d4894e444c1 --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlCe).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlCe).sql new file mode 100644 index 00000000000..74868e13c6f --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlCe).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlCe).sql new file mode 100644 index 00000000000..45caa1ae438 --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlCe).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlCe).sql b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlCe).sql new file mode 100644 index 00000000000..55f96bdffa4 --- /dev/null +++ b/SqlCe/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlCe).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlCe + +SELECT + [p].[FirstName], + [p].[PersonID] as [ID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe).sql b/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe).sql index 9a1da9c769c..a116c853051 100644 --- a/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe).sql +++ b/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlCe).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe).sql b/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe).sql index 23a4349c3e2..0d4539aed42 100644 --- a/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe).sql +++ b/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlCe).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe).sql b/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe).sql index e51b6ee5005..6ad869892f2 100644 --- a/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe).sql +++ b/SqlCe/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlCe).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.LinqService,False).sql b/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.LinqService,False).sql index b84c2f7c819..080b698c426 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.LinqService,False).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.LinqService,False).sql @@ -109,22 +109,24 @@ BeforeExecute -- SqlServer.2005 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.LinqService).sql index 0dd6c8fb288..0b6438f9a72 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.LinqService).sql index ca6b3183692..bb1cb8a3344 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,1).sql b/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,1).sql index d5e8e285e63..2c85ac09d05 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,1).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,2).sql b/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,2).sql index 0c09317d2ab..030a336e8b6 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,2).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.LinqService).sql index 70e4721e0d9..1613122058d 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,14).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,14).sql index 69b5105ab6f..58fafd65b4d 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,14).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,15).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,15).sql index acd45030885..7985383696d 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,15).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,14).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,14).sql index aebda80c7a1..55cca4170a5 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,14).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,15).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,15).sql index af2826c7521..59d6087ffab 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,15).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,14).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,14).sql index efeed976b67..72fb3e7c165 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,14).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,15).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,15).sql index 8ca02fea9cc..b765b027eb2 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,15).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,14).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,14).sql index 60f709c66b1..67d440463bc 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,14).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,15).sql b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,15).sql index 3d242c95fc0..aa8bab46ef6 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,15).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.LinqService).sql index b236cb2065d..cf9d4945ece 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.LinqService).sql index b236cb2065d..cf9d4945ece 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.LinqService).sql index b236cb2065d..cf9d4945ece 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.LinqService).sql index 956beeeca78..49b49d4ba30 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.LinqService).sql index 956beeeca78..49b49d4ba30 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.LinqService).sql index 956beeeca78..49b49d4ba30 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.LinqService).sql index 5b5cf35a45e..84bc4a5ebbb 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.LinqService).sql index 61fd1b1c0e9..82313c1ad73 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.LinqService).sql index ded31518e57..846e8306f0e 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql index e5d62fbffb9..02461f3aa88 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql index f115dd17865..84253acc2a0 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql index 7ab938f8bf1..dbc7a0273e3 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql index e27d11d98f5..3c76e291762 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql index ef728fa204b..c4410bed88b 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql index 01456719117..a23ac5026b9 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql index 6c4219e52d4..e90c4ca2c16 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql index 8b8e9255362..ae71d3d021a 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.LinqService).sql index f2f8fcabcde..8911f79577f 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -570,12 +570,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.LinqService).sql index 467cd6c15d1..2ab66c85d0f 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.LinqService).sql index 36cb736dfc4..bbb792a6be8 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.LinqService).sql index 4cbba65dba1..3a9863ac5ef 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.LinqService).sql index 4cbba65dba1..f6feaa14dca 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.LinqService).sql index 16b4977fcfb..1023e2377e3 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.LinqService).sql index a2c87fdcf1b..4ccb60fa6d0 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.LinqService).sql @@ -2,17 +2,21 @@ -- SqlServer.2005 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2005.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..50e7f374c42 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2005 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..8a37e424e3a --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..46b02a338fc --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.LinqService).sql index 76727be7fd0..46b02a338fc 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.LinqService).sql index 0d8165da001..d23ffc88328 100644 --- a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..d425113dae4 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..154224151d8 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..d23ffc88328 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..7e793993e18 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..76727be7fd0 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.LinqService).sql new file mode 100644 index 00000000000..0d8165da001 --- /dev/null +++ b/SqlServer.2005.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.LinqService).sql index 7b309792baf..ae3b14679ac 100644 --- a/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.LinqService).sql index 2f61cb442d1..838d21a2fd2 100644 --- a/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.LinqService).sql b/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.LinqService).sql index dd1acc4d5d9..4a751fb0aae 100644 --- a/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.LinqService).sql +++ b/SqlServer.2005.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS.LinqService,False).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS.LinqService,False).sql index 0d4d2d2fbbc..9d854a1d82c 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS.LinqService,False).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS.LinqService,False).sql @@ -109,22 +109,24 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS.LinqService).sql index d30654deb3a..9e57d03c318 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS.LinqService).sql index 809e9f8fba9..62d41d8b96c 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,1).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,1).sql index bc8655d2a10..cb6bd6dfe6d 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,1).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,2).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,2).sql index 6147529582f..44752839888 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,2).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS.LinqService).sql index afe78255b59..68e5ccbf09d 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,14).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,14).sql index c0810558ef2..92d3ab025b8 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,14).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,15).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,15).sql index 2abf672b82b..bbcf2c0aa7c 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,15).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,14).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,14).sql index a9b92547dc2..07fc76adb9a 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,14).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,15).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,15).sql index 13c15a30e7c..cf39d9aab56 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,15).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,14).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,14).sql index eb581b21b41..83afa4dc0f6 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,14).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,15).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,15).sql index a766be3b39b..60532ad944c 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,15).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,14).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,14).sql index 68aac37aa17..2e2ee9d591f 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,14).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,15).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,15).sql index cd24a3cf321..47ddf48162b 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,15).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS.LinqService).sql index 21bc534bba8..0138b4e1598 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS.LinqService).sql index 21bc534bba8..0138b4e1598 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS.LinqService).sql index 21bc534bba8..0138b4e1598 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS.LinqService).sql index 356bed5caab..e331df9f43a 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS.LinqService).sql index 356bed5caab..e331df9f43a 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS.LinqService).sql index 356bed5caab..e331df9f43a 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS.LinqService).sql index 24de183ac9d..9a83c2afe42 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS.LinqService).sql index 8ec432ced87..7c8264c3692 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS.LinqService).sql index fcd0559c898..68d26ead07e 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql index a3aca2405d4..99401c21ee9 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql index c0844597d79..d86b95f4b72 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql index 40da19bea2a..2545fa551a7 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql index 6a4c924f2e6..7e73a6180ad 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql index dd076ade32e..87a0e96eee0 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql index 3f33b86894b..abda7ae2b13 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql index 8cfddb021ba..34b8325504f 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql index 067488ec608..30fd288cb4b 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS.LinqService).sql index 0bc7d65a0f4..182090d8fd3 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -570,12 +570,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS.LinqService).sql index 8ebd3d3589f..a381b2eeff6 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS.LinqService).sql index 4ea0be4592c..ca11d719190 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS.LinqService).sql index 8aeb7502e3f..1cfd1aa5033 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS.LinqService).sql index 8aeb7502e3f..6fa0ac909c7 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS.LinqService).sql index 5af6625bdcc..9521c00bb1b 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS.LinqService).sql index fda0322555a..33710ea9b5e 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS.LinqService).sql @@ -2,17 +2,21 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..aa6066c2f52 --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..f4f2d09e751 --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..4d619cf9a13 --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS.LinqService).sql index 2376bfc9f5d..4d619cf9a13 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS.LinqService).sql index 81792010ed2..efb6c34a031 100644 --- a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..ce32804374b --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..588c6482b18 --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..efb6c34a031 --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..560dfb12e9a --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..2376bfc9f5d --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.MS.LinqService).sql new file mode 100644 index 00000000000..81792010ed2 --- /dev/null +++ b/SqlServer.2005.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS.LinqService).sql index 4c254679fa9..6eaf7176f6d 100644 --- a/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS.LinqService).sql index 0617ab613a5..43d26cd84de 100644 --- a/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS.LinqService).sql b/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS.LinqService).sql index cd77e54beac..679e2a0a0dc 100644 --- a/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS.LinqService).sql +++ b/SqlServer.2005.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS,False).sql b/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS,False).sql index 5a59f0b55c1..cff081c539f 100644 --- a/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS,False).sql +++ b/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005.MS,False).sql @@ -35,22 +35,24 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS).sql index d30654deb3a..9e57d03c318 100644 --- a/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005.MS).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS).sql index 809e9f8fba9..62d41d8b96c 100644 --- a/SqlServer.2005.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,1).sql b/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,1).sql index bc8655d2a10..cb6bd6dfe6d 100644 --- a/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,1).sql +++ b/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,2).sql b/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,2).sql index 6147529582f..44752839888 100644 --- a/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,2).sql +++ b/SqlServer.2005.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005.MS,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS).sql index afe78255b59..68e5ccbf09d 100644 --- a/SqlServer.2005.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005.MS).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,14).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,14).sql index 6a5357a9302..cd8704bcdab 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,14).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,15).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,15).sql index 37530dc6556..eabd79ba9ae 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,15).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,14).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,14).sql index 9ab565c5a15..f0f89a26344 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,14).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,15).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,15).sql index 58bff6bc87d..13f959ae0be 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,15).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,14).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,14).sql index 79bf92dab51..21eecebea4a 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,14).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,15).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,15).sql index 3d45a7dabe6..feaedc7b002 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,15).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,14).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,14).sql index 7b825f72420..530addd8b93 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,14).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,15).sql b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,15).sql index 34db29d46e6..d979491d921 100644 --- a/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,15).sql +++ b/SqlServer.2005.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS).sql index 21bc534bba8..0138b4e1598 100644 --- a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS).sql index 21bc534bba8..0138b4e1598 100644 --- a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS).sql index 21bc534bba8..0138b4e1598 100644 --- a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS).sql index 356bed5caab..e331df9f43a 100644 --- a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS).sql index 356bed5caab..e331df9f43a 100644 --- a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS).sql index 356bed5caab..e331df9f43a 100644 --- a/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005.MS).sql index 9249d54b978..99f10be2780 100644 --- a/SqlServer.2005.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS).sql index 24de183ac9d..9a83c2afe42 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS).sql index 8ec432ced87..7c8264c3692 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS).sql index fcd0559c898..68d26ead07e 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql index a3aca2405d4..99401c21ee9 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql index c0844597d79..d86b95f4b72 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql index 40da19bea2a..2545fa551a7 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql index 6a4c924f2e6..7e73a6180ad 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql index dd076ade32e..87a0e96eee0 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql index 3f33b86894b..abda7ae2b13 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql index 8cfddb021ba..34b8325504f 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql index 067488ec608..30fd288cb4b 100644 --- a/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS).sql index ffff2e32763..75a65d22dd9 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005.MS).sql @@ -84,12 +84,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -131,12 +131,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS).sql index 7dc64ce92be..312d1cfc8fa 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005.MS).sql @@ -84,12 +84,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS).sql index 4ea0be4592c..ca11d719190 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS).sql index 8aeb7502e3f..1cfd1aa5033 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS).sql index 8aeb7502e3f..6fa0ac909c7 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS).sql index 5af6625bdcc..9521c00bb1b 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS).sql index fda0322555a..33710ea9b5e 100644 --- a/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005.MS).sql @@ -2,17 +2,21 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2005.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..ae912a4a55f --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005.MS).sql @@ -0,0 +1,67 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +SELECT 1,10,NULL,NULL UNION ALL +SELECT 2,NULL,20,NULL UNION ALL +SELECT 3,NULL,NULL,30 UNION ALL +SELECT 4,NULL,NULL,NULL + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..f4f2d09e751 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..4d619cf9a13 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS).sql index 2376bfc9f5d..4d619cf9a13 100644 --- a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS).sql index 81792010ed2..efb6c34a031 100644 --- a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2005.MS SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..ce32804374b --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..588c6482b18 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..efb6c34a031 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..560dfb12e9a --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..2376bfc9f5d --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.MS).sql new file mode 100644 index 00000000000..81792010ed2 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 03).sql b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 03).sql index 286765cd4f1..5fc0dc83d1d 100644 --- a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 03).sql +++ b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 04).sql b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 04).sql index ff894fa12c1..697a6ca69a3 100644 --- a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 04).sql +++ b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 05).sql b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 05).sql index b7817c9060d..7239d43a665 100644 --- a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 05).sql +++ b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 06).sql b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 06).sql index 3a08d9f12e8..c45840bcd7b 100644 --- a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 06).sql +++ b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 07).sql b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 07).sql index 13516b7571b..db83a055886 100644 --- a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 07).sql +++ b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 12).sql b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 12).sql index 98b5a00ce7c..0cbfea19c5a 100644 --- a/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 12).sql +++ b/SqlServer.2005.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005.MS SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005.MS SqlServer.2005 diff --git a/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS).sql index 4c254679fa9..6eaf7176f6d 100644 --- a/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS).sql index 0617ab613a5..43d26cd84de 100644 --- a/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS).sql index cd77e54beac..679e2a0a0dc 100644 --- a/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS).sql +++ b/SqlServer.2005.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005,False).sql b/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005,False).sql index 61e68758ec1..080369a6872 100644 --- a/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005,False).sql +++ b/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2005,False).sql @@ -35,22 +35,24 @@ BeforeExecute -- SqlServer.2005 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005).sql index 0dd6c8fb288..0b6438f9a72 100644 --- a/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2005).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005).sql index ca6b3183692..bb1cb8a3344 100644 --- a/SqlServer.2005/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2005).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,1).sql b/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,1).sql index d5e8e285e63..2c85ac09d05 100644 --- a/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,1).sql +++ b/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,2).sql b/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,2).sql index 0c09317d2ab..030a336e8b6 100644 --- a/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,2).sql +++ b/SqlServer.2005/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2005,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT N'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT N'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT N'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2005/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005).sql index 70e4721e0d9..1613122058d 100644 --- a/SqlServer.2005/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2005).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,14).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,14).sql index dbfe63ad992..60329f12c0d 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,14).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,15).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,15).sql index 35e7a1a4d21..e63436c17f5 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,15).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2005,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,14).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,14).sql index 571fac21791..5f708f12f9d 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,14).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,15).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,15).sql index b134fbe17b7..a0d99b4e283 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,15).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2005,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,14).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,14).sql index 8ff01d0c3f4..3284af0e6f3 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,14).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,15).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,15).sql index cbc65ec3f4e..6963d736bc0 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,15).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2005,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,14).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,14).sql index c39933f769a..46103d6bcbd 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,14).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,15).sql b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,15).sql index a8ff3bcb05d..6b3d1723a88 100644 --- a/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,15).sql +++ b/SqlServer.2005/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2005,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005).sql index b236cb2065d..cf9d4945ece 100644 --- a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2005).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005).sql index b236cb2065d..cf9d4945ece 100644 --- a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2005).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005).sql index b236cb2065d..cf9d4945ece 100644 --- a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2005).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005).sql index 956beeeca78..49b49d4ba30 100644 --- a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2005).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005).sql index 956beeeca78..49b49d4ba30 100644 --- a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2005).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005).sql index 956beeeca78..49b49d4ba30 100644 --- a/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2005).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2005/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005).sql index 86295445edc..3a34c2e5bf7 100644 --- a/SqlServer.2005/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2005).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005).sql index 5b5cf35a45e..84bc4a5ebbb 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2005).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005).sql index 61fd1b1c0e9..82313c1ad73 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2005).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005).sql index ded31518e57..846e8306f0e 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2005).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql index e5d62fbffb9..02461f3aa88 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql index f115dd17865..84253acc2a0 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql @@ -2,13 +2,13 @@ -- SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql index 7ab938f8bf1..dbc7a0273e3 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql index e27d11d98f5..3c76e291762 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql index ef728fa204b..c4410bed88b 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2005).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql index 01456719117..a23ac5026b9 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2005).sql @@ -2,13 +2,13 @@ -- SqlServer.2005 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql index 6c4219e52d4..e90c4ca2c16 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2005).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql index 8b8e9255362..ae71d3d021a 100644 --- a/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2005).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005).sql index 0992cc7add0..5c049e5f4b2 100644 --- a/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2005).sql @@ -84,12 +84,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -131,12 +131,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005).sql index dc3c023936d..9e30427d9a1 100644 --- a/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2005).sql @@ -84,12 +84,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005).sql index 36cb736dfc4..bbb792a6be8 100644 --- a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2005).sql @@ -2,11 +2,11 @@ -- SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005).sql index 4cbba65dba1..3a9863ac5ef 100644 --- a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2005).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005).sql index 4cbba65dba1..f6feaa14dca 100644 --- a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2005).sql @@ -2,11 +2,11 @@ -- SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005).sql index 16b4977fcfb..1023e2377e3 100644 --- a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2005).sql @@ -2,11 +2,11 @@ -- SqlServer.2005 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005).sql index a2c87fdcf1b..4ccb60fa6d0 100644 --- a/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2005).sql @@ -2,17 +2,21 @@ -- SqlServer.2005 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2005/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005).sql new file mode 100644 index 00000000000..bdade8cd459 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2005).sql @@ -0,0 +1,67 @@ +BeforeExecute +-- SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2005 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +SELECT 1,10,NULL,NULL UNION ALL +SELECT 2,NULL,20,NULL UNION ALL +SELECT 3,NULL,NULL,30 UNION ALL +SELECT 4,NULL,NULL,NULL + +BeforeExecute +-- SqlServer.2005 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2005 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2005 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005).sql new file mode 100644 index 00000000000..8a37e424e3a --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2005).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005).sql new file mode 100644 index 00000000000..46b02a338fc --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2005).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005).sql index 76727be7fd0..46b02a338fc 100644 --- a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2005).sql @@ -2,17 +2,10 @@ -- SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005).sql index 0d8165da001..d23ffc88328 100644 --- a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2005).sql @@ -2,14 +2,10 @@ -- SqlServer.2005 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005).sql new file mode 100644 index 00000000000..d425113dae4 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2005).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005).sql new file mode 100644 index 00000000000..154224151d8 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2005).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005).sql new file mode 100644 index 00000000000..d23ffc88328 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2005).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005).sql new file mode 100644 index 00000000000..7e793993e18 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2005).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005).sql new file mode 100644 index 00000000000..76727be7fd0 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2005).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005).sql new file mode 100644 index 00000000000..0d8165da001 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2005).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2005 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 03).sql b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 03).sql index 74ff6cf6e70..038f27337bd 100644 --- a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 03).sql +++ b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 04).sql b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 04).sql index e36d0c5f8db..00c82a3d92f 100644 --- a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 04).sql +++ b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 05).sql b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 05).sql index ba5995052b9..8177aeff861 100644 --- a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 05).sql +++ b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 06).sql b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 06).sql index 1fe0a50ca7e..1a129ee9d80 100644 --- a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 06).sql +++ b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 07).sql b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 07).sql index baa49558419..244db488aa3 100644 --- a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 07).sql +++ b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 12).sql b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 12).sql index e9543b9d5fb..d952ef822d2 100644 --- a/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 12).sql +++ b/SqlServer.2005/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2005,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2005 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2005 diff --git a/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005).sql b/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005).sql index 7b309792baf..ae3b14679ac 100644 --- a/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2005).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005).sql b/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005).sql index 2f61cb442d1..838d21a2fd2 100644 --- a/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2005).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005).sql b/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005).sql index dd1acc4d5d9..4a751fb0aae 100644 --- a/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005).sql +++ b/SqlServer.2005/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2005).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.LinqService,False).sql b/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.LinqService,False).sql index 17967b6ac86..4f6c479857b 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.LinqService,False).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.LinqService,False).sql @@ -109,22 +109,24 @@ BeforeExecute -- SqlServer.2008 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.LinqService).sql index 0fff2dfc36d..6da28bf3d30 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.LinqService).sql index 406df06c5be..8bd8ece09f8 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.LinqService).sql index 95671400794..e8346b42201 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.LinqService).sql index add945343f1..578061f0d1a 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.LinqService).sql index 21d16b9a0fb..6a72fc0f251 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.LinqService).sql index 1f4b17477a6..a64ce4a00cc 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.LinqService).sql index 3948976fd51..4efb7ee0a77 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.LinqService).sql index d49ff3c4234..e2e339736dd 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.LinqService).sql index d58a3c9ad92..cc28835294f 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.LinqService).sql index 96ed6080ff2..31d70a7884b 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.LinqService).sql index e753b479388..3a799b973e0 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.LinqService).sql index 7d6bd6c8b17..b346309a52a 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.LinqService).sql index f0913adb37c..4b95388beda 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.LinqService).sql index a20d38a3f35..bbe436aa968 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.LinqService).sql index b81c4b5470d..f6beb62505e 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.LinqService).sql index 951ba321654..6448a8845d6 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.LinqService).sql index 078a09ccf31..7e0ecb57a03 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.LinqService).sql index 8e8763fd341..57d0da8aad1 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.LinqService).sql index 01aaaf916f2..e75cbca32a4 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.LinqService).sql index e2de8af56e7..c1978dffd5b 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,1).sql b/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,1).sql index 7954d24c207..0eb5a162c2a 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,1).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,2).sql b/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,2).sql index 70789e0a8a9..eec44c11d5f 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,2).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.LinqService).sql index 287e5e13759..a86081a3db6 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,14).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,14).sql index dcb4e49256b..34302d015bd 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,14).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,15).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,15).sql index 53e1a00feca..40c1eac9be9 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,15).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,14).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,14).sql index 0c730d58c25..e98647557c2 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,14).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,15).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,15).sql index 5f9956e153c..ba208ea4e1e 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,15).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,14).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,14).sql index a908890bd19..d329a3ea2fc 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,14).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,15).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,15).sql index 95148bba050..b79237d7eb7 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,15).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,14).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,14).sql index 482b9843942..fa05d45e34c 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,14).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,15).sql b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,15).sql index 5817b1b1229..db15d8b6690 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,15).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.LinqService).sql index 47fced06674..77d301e0533 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.LinqService).sql index 47fced06674..77d301e0533 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.LinqService).sql index 47fced06674..77d301e0533 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.LinqService).sql index 5bf4177e91f..cfefe7669a6 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.LinqService).sql index 5bf4177e91f..cfefe7669a6 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.LinqService).sql index 5bf4177e91f..cfefe7669a6 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.LinqService).sql index cc6db2cd449..28749d76e79 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.LinqService).sql index 287930261f2..5aec3852be2 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.LinqService).sql index a7de0c7c438..862da1fb49a 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql index ce59089d49a..0d4880e97a3 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql index 6b723ab56eb..ccf3b730719 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql index b7f5bb102c2..db0dd843fba 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql index 6df32c86f74..7a7a64fdd4a 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql index dd068fcf1e3..4ce449ea585 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql index d6d5954af07..b5ec2d94f0d 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql index e0f91728703..2acb6c2b3fe 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql index c81b6ce69f3..663b87a07b3 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.LinqService).sql index 22fe9dedcdc..c56a60d2c13 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -570,12 +570,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.LinqService).sql index 6787af3ad43..31f47b8cbb5 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.LinqService).sql index 80a42528c79..17bf8d9c745 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.LinqService).sql index 998485767c5..d2a7cc0a828 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.LinqService).sql index 998485767c5..b7d4e687af4 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.LinqService).sql index 54a2d43137e..3ce1cd20036 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.LinqService).sql index bba824a77aa..3c0892e9072 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.LinqService).sql @@ -2,17 +2,21 @@ -- SqlServer.2008 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2008.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..77b91f518e6 --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2008 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..021d70252ea --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..ecf8cf9fae6 --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.LinqService).sql index 208b99fa425..ecf8cf9fae6 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.LinqService).sql index 8dfdb0ef527..ccb6dab4480 100644 --- a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..c8eebdd38ec --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..d494e41bf0c --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..ccb6dab4480 --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..14e41819f1d --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..208b99fa425 --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.LinqService).sql new file mode 100644 index 00000000000..8dfdb0ef527 --- /dev/null +++ b/SqlServer.2008.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.LinqService).sql index 6f4c3377577..73d0550047a 100644 --- a/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.LinqService).sql index ea4d0114d3e..bbf1ddef237 100644 --- a/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.LinqService).sql b/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.LinqService).sql index 8a3b9c3e2cd..8819d605b80 100644 --- a/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.LinqService).sql +++ b/SqlServer.2008.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS.LinqService,False).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS.LinqService,False).sql index 16821a5e8ad..f10600701ef 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS.LinqService,False).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS.LinqService,False).sql @@ -109,22 +109,24 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS.LinqService).sql index a8b93d5bd85..5735dcc86d4 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS.LinqService).sql index f7da203bba9..13b2430045f 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS.LinqService).sql index d81ed0c8526..13100bf0058 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS.LinqService).sql index e047f7f3f53..924e9acdbe2 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS.LinqService).sql index 4bc88541e36..a6283a7058d 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS.LinqService).sql index 82b6b97cbd6..2f1c4318689 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS.LinqService).sql index 65c2d1dd744..a6664b7d8bb 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS.LinqService).sql index 6a2c20a638f..0ec696ff831 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS.LinqService).sql index cebad1ba168..7cc74d9097e 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS.LinqService).sql index eea762a56a4..44485c2a959 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS.LinqService).sql index c4c2d501874..66ab7c9d211 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS.LinqService).sql index 296999672e4..bd037d40f01 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS.LinqService).sql index 7ea1e19cc43..34e4185f58b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS.LinqService).sql index d90d3612aa9..d543e0567b3 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS.LinqService).sql index dd743da18b0..b5873b9987b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS.LinqService).sql index 536ade2a33c..f0be97d941b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS.LinqService).sql index e56a47f9064..aa0fc9f8319 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS.LinqService).sql index 1df5b90e074..44ae9e6051f 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS.LinqService).sql index f05ee3cab64..a5f59f674b6 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS.LinqService).sql index 6242b50192c..76c70ed784a 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,1).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,1).sql index cabd55e94cc..850c9652133 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,1).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,2).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,2).sql index 60409848228..38aa9fe80af 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,2).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS.LinqService).sql index a48bf691200..17fb7537cbe 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,14).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,14).sql index 07f5febcbbc..618e5f2404e 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,14).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,15).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,15).sql index a10681832ea..306cfd58960 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,15).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,14).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,14).sql index f5696dd92b6..1b7b36c2f0b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,14).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,15).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,15).sql index 172100b1d6b..8cbd35d9c9d 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,15).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,14).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,14).sql index fe0788b6797..d1c54159fe4 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,14).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,15).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,15).sql index ecccb28f502..073b6124141 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,15).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,14).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,14).sql index 80e1b4049e1..3b29054ac52 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,14).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,15).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,15).sql index cb4bcea97df..97182fcffe8 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,15).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS.LinqService).sql index f233a06cfff..7f8cb25b781 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS.LinqService).sql index f233a06cfff..7f8cb25b781 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS.LinqService).sql index f233a06cfff..7f8cb25b781 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS.LinqService).sql index d3f241dfa53..b385e0ca91b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS.LinqService).sql index d3f241dfa53..b385e0ca91b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS.LinqService).sql index d3f241dfa53..b385e0ca91b 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS.LinqService).sql index 67719d76bf5..60d8485fdc3 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS.LinqService).sql index f0969f260b9..269a9e56471 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS.LinqService).sql index 642371e802f..f62b0e39fd8 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql index d2a9f2ffa6f..1bfa7d7a301 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql index b9eedec56a5..b3ea733f23f 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql index 03b9145a445..cf2311870c6 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql index 894dcee05cc..63fe0c05897 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql index 7273a400366..2a9ab8fc3c3 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql index d66a8236da7..9266a1ad1d1 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql index bd7faf7e173..6e661405715 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql index 52b881fdd2d..22a9bc22b98 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS.LinqService).sql index a800ef1b5be..f3c5c739a8c 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -570,12 +570,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS.LinqService).sql index 031f2b67e1b..279700d7305 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS.LinqService).sql @@ -523,12 +523,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS.LinqService).sql index ba02f8ce60b..da1b2fade44 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS.LinqService).sql index 9beb77fbd42..3d5d37fe466 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS.LinqService).sql index 9beb77fbd42..fcc4d565d87 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS.LinqService).sql index a90eae4e97e..12fa185963c 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS.LinqService).sql index d96e5f3eb66..ae3e548d2fc 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS.LinqService).sql @@ -2,17 +2,21 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..47ab9c36bd9 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..87aaff6d284 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..0709af405ce --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS.LinqService).sql index 38de64cb8b6..0709af405ce 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS.LinqService).sql index 58c77f3ac72..192de5d8474 100644 --- a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..354e8204a60 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..eb611695cd0 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..192de5d8474 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..c9f8cbad9f8 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..38de64cb8b6 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.MS.LinqService).sql new file mode 100644 index 00000000000..58c77f3ac72 --- /dev/null +++ b/SqlServer.2008.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS.LinqService).sql index 4cd9c16121d..67f98890481 100644 --- a/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS.LinqService).sql index b351881572a..ffd99bc429f 100644 --- a/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS.LinqService).sql b/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS.LinqService).sql index 6cc68e4f84d..d549b31dde8 100644 --- a/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS.LinqService).sql +++ b/SqlServer.2008.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008.MS).sql index 357e25aead5..e41388c19fe 100644 --- a/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008.MS).sql index 357e25aead5..e41388c19fe 100644 --- a/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008.MS).sql index 3c8816ddc21..500dad4b8cf 100644 --- a/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS,False).sql b/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS,False).sql index 7c208ef18df..0c01ae2e5af 100644 --- a/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS,False).sql +++ b/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008.MS,False).sql @@ -36,22 +36,24 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS).sql index a8b93d5bd85..5735dcc86d4 100644 --- a/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008.MS).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS).sql index 9e702112c08..dd8f47e6365 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS).sql index caa4d3de84c..f57254a5c26 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS).sql index 31447a56c2f..63de9f11792 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS).sql index 5950f3506d3..d032c942e69 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS).sql index b5ba56a6de0..13dc0662f8c 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS).sql index fc47c05dad8..d59bc6075fe 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS).sql index 5593128e0bf..0448ec2bfaa 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS).sql index 10d6d95569a..7b45a81e6d8 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS).sql index 2c35eaefb7b..cf014ea753f 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS).sql index 727464ca12d..37c27b70577 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS).sql index 22792a1c038..e721f004991 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS).sql index 1e821f051e6..bacd76f06aa 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS).sql index 52a18f453ca..a3922790de0 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS).sql index 641fa104b52..d07970e54ae 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS).sql index dffd906263e..3ab5aa97c0e 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS).sql index 5a02923b40b..a44f4ae1283 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS).sql index d1f83af39e1..ef8c5770c14 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS).sql index 3426eeac722..236ed52a1ab 100644 --- a/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS).sql index 6242b50192c..76c70ed784a 100644 --- a/SqlServer.2008.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,1).sql b/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,1).sql index cabd55e94cc..850c9652133 100644 --- a/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,1).sql +++ b/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,2).sql b/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,2).sql index 60409848228..38aa9fe80af 100644 --- a/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,2).sql +++ b/SqlServer.2008.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS).sql index a48bf691200..17fb7537cbe 100644 --- a/SqlServer.2008.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008.MS).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,14).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,14).sql index 49d302382bf..a4a4793afa9 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,14).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,15).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,15).sql index 7558840caa4..10fb7bf1931 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,15).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,14).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,14).sql index 913c1a1bd91..7bd7ef61170 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,14).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,15).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,15).sql index ed281a162b9..8a35ab285b9 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,15).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,14).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,14).sql index 901c2e3a84e..2e1255805ed 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,14).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,15).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,15).sql index 3f7f82e2a3a..51cdb615d29 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,15).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,14).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,14).sql index 2076a7a62b4..a84034cb810 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,14).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,15).sql b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,15).sql index dff2bce2123..74b3f7b8983 100644 --- a/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,15).sql +++ b/SqlServer.2008.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS).sql index f233a06cfff..7f8cb25b781 100644 --- a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS).sql index f233a06cfff..7f8cb25b781 100644 --- a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS).sql index f233a06cfff..7f8cb25b781 100644 --- a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS).sql index d3f241dfa53..b385e0ca91b 100644 --- a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS).sql index d3f241dfa53..b385e0ca91b 100644 --- a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS).sql index d3f241dfa53..b385e0ca91b 100644 --- a/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008.MS).sql index 80d431fd8a4..413d9bd5aac 100644 --- a/SqlServer.2008.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS).sql index 67719d76bf5..60d8485fdc3 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS).sql index f0969f260b9..269a9e56471 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS).sql index 642371e802f..f62b0e39fd8 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql index d2a9f2ffa6f..1bfa7d7a301 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql index b9eedec56a5..b3ea733f23f 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql index 03b9145a445..cf2311870c6 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql index 894dcee05cc..63fe0c05897 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql index 7273a400366..2a9ab8fc3c3 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql index d66a8236da7..9266a1ad1d1 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql index bd7faf7e173..6e661405715 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql index 52b881fdd2d..22a9bc22b98 100644 --- a/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS).sql index cb565497978..b799645b8b2 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008.MS).sql @@ -85,12 +85,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -132,12 +132,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS).sql index b8bfe64ee37..fa376c723a6 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008.MS).sql @@ -85,12 +85,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS).sql index ba02f8ce60b..da1b2fade44 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS).sql index 9beb77fbd42..3d5d37fe466 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS).sql index 9beb77fbd42..fcc4d565d87 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS).sql index a90eae4e97e..12fa185963c 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS).sql index d96e5f3eb66..ae3e548d2fc 100644 --- a/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008.MS).sql @@ -2,17 +2,21 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..8bfddfbf7b9 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008.MS).sql @@ -0,0 +1,68 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008.MS).sql index 0612f17dc67..64965d0b85e 100644 --- a/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as [Any_1] + END as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -104,5 +104,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..87aaff6d284 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..0709af405ce --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS).sql index 38de64cb8b6..0709af405ce 100644 --- a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS).sql index 58c77f3ac72..192de5d8474 100644 --- a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2008.MS SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..354e8204a60 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..eb611695cd0 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..192de5d8474 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..c9f8cbad9f8 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..38de64cb8b6 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.MS).sql new file mode 100644 index 00000000000..58c77f3ac72 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 03).sql b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 03).sql index 003e00841c6..b66e30a9f31 100644 --- a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 03).sql +++ b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 03).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 04).sql b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 04).sql index 5d94a508901..1b2a7837922 100644 --- a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 04).sql +++ b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 04).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 05).sql b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 05).sql index 725f1cd3656..5e208313a5b 100644 --- a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 05).sql +++ b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 05).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 06).sql b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 06).sql index 95b1dbbde26..c0a63d8a0de 100644 --- a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 06).sql +++ b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 06).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 07).sql b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 07).sql index cb154f75d9e..77c9852da6e 100644 --- a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 07).sql +++ b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 07).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 12).sql b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 12).sql index 5e5e72a238c..a4cd6aa207d 100644 --- a/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 12).sql +++ b/SqlServer.2008.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008.MS,Query 12).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008.MS SqlServer.2008 diff --git a/SqlServer.2008.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008.MS).sql index 9b10ed55458..8a93fe40081 100644 --- a/SqlServer.2008.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008.MS).sql @@ -86,21 +86,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -122,10 +122,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2008.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008.MS).sql index a5f8592fa90..3ac7e9b6f17 100644 --- a/SqlServer.2008.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008.MS).sql @@ -130,7 +130,7 @@ BeforeExecute -- SqlServer.2008.MS SqlServer.2008 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -166,7 +166,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -263,7 +263,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS).sql index 4cd9c16121d..67f98890481 100644 --- a/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS).sql index b351881572a..ffd99bc429f 100644 --- a/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS).sql index 6cc68e4f84d..d549b31dde8 100644 --- a/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS).sql +++ b/SqlServer.2008.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008).sql index 737835743b9..6500cebe9fa 100644 --- a/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2008).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008).sql index 737835743b9..6500cebe9fa 100644 --- a/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2008).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008).sql index f7262014fdd..274909e1df8 100644 --- a/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2008).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008,False).sql b/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008,False).sql index fd3197c5d8e..79a1c09c072 100644 --- a/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008,False).sql +++ b/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2008,False).sql @@ -36,22 +36,24 @@ BeforeExecute -- SqlServer.2008 SELECT - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + CASE + WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] + ELSE 0 + END as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - CASE - WHEN [g_1].[EnumValue] IS NOT NULL THEN [g_1].[EnumValue] - ELSE 0 - END + [t1].[EnumValue] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008).sql index 0fff2dfc36d..6da28bf3d30 100644 --- a/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2008).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008).sql index 6d1b5db1ef3..a038f9e5217 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008).sql index b198be00e66..82db2146f31 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008).sql index 40b945f1112..9b03c51f0a3 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008).sql index 1162921ded0..15e3578d27f 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008).sql index 801ab4d923b..7ad7006beeb 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008).sql index 64ef40f84e8..9a799e32dd1 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008).sql index 1c45298133a..f7e2186d440 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008).sql index 611c4883afe..d7607b87a1f 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008).sql index 6d2c87ee854..562352c26c7 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008).sql index f9018dcdfcc..cdaeddfa521 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008).sql index fe7be2becb5..bd4a636cc8a 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008).sql index 6071fb20938..724db21a802 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008).sql index 99aa113cf8c..17325875d45 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008).sql index cfb1e383e3c..21ff3354414 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008).sql index aa1a98e1d0f..e99b366ec9a 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008).sql index 6e8263d62fd..ee0db4e1271 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008).sql index 3f12859e267..90136cd23c2 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008).sql index bc0d2b96870..9140cf9bfe4 100644 --- a/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2008).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008).sql index e2de8af56e7..c1978dffd5b 100644 --- a/SqlServer.2008/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2008).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,1).sql b/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,1).sql index 7954d24c207..0eb5a162c2a 100644 --- a/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,1).sql +++ b/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,2).sql b/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,2).sql index 70789e0a8a9..eec44c11d5f 100644 --- a/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,2).sql +++ b/SqlServer.2008/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2008,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2008/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008).sql index 287e5e13759..a86081a3db6 100644 --- a/SqlServer.2008/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2008).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,14).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,14).sql index 80fd8695bb6..28473d5cbd9 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,14).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,15).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,15).sql index efd012492d4..e0697c9ffd8 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,15).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2008,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,14).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,14).sql index 9a67d1db800..0e9d9539d78 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,14).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,15).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,15).sql index 29e1d42c70c..f54cf408fbb 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,15).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2008,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,14).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,14).sql index 2effe5c44f1..56258e3dcfa 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,14).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,15).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,15).sql index ac5880b1ca4..c979faa41e7 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,15).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2008,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,14).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,14).sql index 12289dcb6a5..613274ec0a6 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,14).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,15).sql b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,15).sql index 794ceef3485..c59b519de03 100644 --- a/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,15).sql +++ b/SqlServer.2008/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2008,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008).sql index 47fced06674..77d301e0533 100644 --- a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2008).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008).sql index 47fced06674..77d301e0533 100644 --- a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2008).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008).sql index 47fced06674..77d301e0533 100644 --- a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2008).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008).sql index 5bf4177e91f..cfefe7669a6 100644 --- a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2008).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008).sql index 5bf4177e91f..cfefe7669a6 100644 --- a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2008).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008).sql index 5bf4177e91f..cfefe7669a6 100644 --- a/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2008).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2008/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008).sql index 04a3d0afd1d..b498b6bf6d3 100644 --- a/SqlServer.2008/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2008).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008).sql index cc6db2cd449..28749d76e79 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2008).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008).sql index 287930261f2..5aec3852be2 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2008).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008).sql index a7de0c7c438..862da1fb49a 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2008).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql index ce59089d49a..0d4880e97a3 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql index 6b723ab56eb..ccf3b730719 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql @@ -2,13 +2,13 @@ -- SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql index b7f5bb102c2..db0dd843fba 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql index 6df32c86f74..7a7a64fdd4a 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql index dd068fcf1e3..4ce449ea585 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2008).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql index d6d5954af07..b5ec2d94f0d 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2008).sql @@ -2,13 +2,13 @@ -- SqlServer.2008 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql index e0f91728703..2acb6c2b3fe 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2008).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql index c81b6ce69f3..663b87a07b3 100644 --- a/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2008).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008).sql index 05bbb280b7a..20688e99879 100644 --- a/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2008).sql @@ -85,12 +85,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1])) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1])) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) @@ -132,12 +132,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MIN([g_1].[OrderData1]) DESC) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MIN([x].[OrderData1]) DESC) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008).sql index 503ffb3cc6c..1742da3e3a0 100644 --- a/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2008).sql @@ -85,12 +85,12 @@ SELECT FROM ( SELECT - [g_1].[DuplicateData], - ROW_NUMBER() OVER (ORDER BY MAX([g_1].[OrderData1] % 3)) as [RN] + [x].[DuplicateData], + ROW_NUMBER() OVER (ORDER BY MAX([x].[OrderData1] % 3)) as [RN] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ) [t1] WHERE [t1].[RN] > @skip AND [t1].[RN] <= (@skip + @take) diff --git a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008).sql index 80a42528c79..17bf8d9c745 100644 --- a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2008).sql @@ -2,11 +2,11 @@ -- SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008).sql index 998485767c5..d2a7cc0a828 100644 --- a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2008).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008).sql index 998485767c5..b7d4e687af4 100644 --- a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2008).sql @@ -2,11 +2,11 @@ -- SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008).sql index 54a2d43137e..3ce1cd20036 100644 --- a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2008).sql @@ -2,11 +2,11 @@ -- SqlServer.2008 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008).sql index bba824a77aa..3c0892e9072 100644 --- a/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2008).sql @@ -2,17 +2,21 @@ -- SqlServer.2008 SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008).sql new file mode 100644 index 00000000000..2eb521a222c --- /dev/null +++ b/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2008).sql @@ -0,0 +1,68 @@ +BeforeExecute +-- SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2008 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2008 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2008 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2008 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008).sql index a30dd49d66d..144cecc8de0 100644 --- a/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2008).sql @@ -2,38 +2,28 @@ -- SqlServer.2008 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], CASE WHEN EXISTS( SELECT @@ -45,7 +35,17 @@ FROM ) THEN 1 ELSE 0 - END as [Any_1] + END as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -104,5 +104,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008).sql new file mode 100644 index 00000000000..021d70252ea --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2008).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008).sql new file mode 100644 index 00000000000..ecf8cf9fae6 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2008).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008).sql index 208b99fa425..ecf8cf9fae6 100644 --- a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2008).sql @@ -2,17 +2,10 @@ -- SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008).sql index 8dfdb0ef527..ccb6dab4480 100644 --- a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2008).sql @@ -2,14 +2,10 @@ -- SqlServer.2008 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008).sql new file mode 100644 index 00000000000..c8eebdd38ec --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2008).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008).sql new file mode 100644 index 00000000000..d494e41bf0c --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2008).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008).sql new file mode 100644 index 00000000000..ccb6dab4480 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2008).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008).sql new file mode 100644 index 00000000000..14e41819f1d --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2008).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008).sql new file mode 100644 index 00000000000..208b99fa425 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2008).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008).sql new file mode 100644 index 00000000000..8dfdb0ef527 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2008).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2008 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 03).sql b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 03).sql index 183bf120f43..c70b68b1087 100644 --- a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 03).sql +++ b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 03).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 04).sql b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 04).sql index b89c914ca72..3c39fbeca2f 100644 --- a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 04).sql +++ b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 04).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 05).sql b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 05).sql index 0455b2f7831..40e5af25a37 100644 --- a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 05).sql +++ b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 05).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 06).sql b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 06).sql index 0a4e69b0d28..9d023442da9 100644 --- a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 06).sql +++ b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 06).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 07).sql b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 07).sql index 7fa32cf871d..acd3558598c 100644 --- a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 07).sql +++ b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 07).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 12).sql b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 12).sql index 2277294b41a..591f5f1763e 100644 --- a/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 12).sql +++ b/SqlServer.2008/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2008,Query 12).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2008 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2008 diff --git a/SqlServer.2008/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008).sql b/SqlServer.2008/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008).sql index 9bdf9aa8f8b..08dda759e89 100644 --- a/SqlServer.2008/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2008).sql @@ -86,21 +86,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -122,10 +122,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2008/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008).sql b/SqlServer.2008/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008).sql index 5fa90f0f91a..c151ce7afc6 100644 --- a/SqlServer.2008/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2008).sql @@ -130,7 +130,7 @@ BeforeExecute -- SqlServer.2008 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -166,7 +166,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -263,7 +263,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008).sql b/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008).sql index 6f4c3377577..73d0550047a 100644 --- a/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2008).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008).sql b/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008).sql index ea4d0114d3e..bbf1ddef237 100644 --- a/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2008).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008).sql b/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008).sql index 8a3b9c3e2cd..8819d605b80 100644 --- a/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008).sql +++ b/SqlServer.2008/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2008).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t4].[ParentID], [t3].[ChildID] FROM - [Parent] [x] + [Parent] [t4] INNER JOIN ( SELECT [t2].[ParentID], @@ -35,7 +35,7 @@ FROM ) [t2] WHERE [t2].[RN] > 10 AND [t2].[RN] <= 20 - ) [t3] ON [t3].[ParentID] = [x].[ParentID] + ) [t3] ON [t3].[ParentID] = [t4].[ParentID] ORDER BY - [x].[ParentID] + [t4].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.LinqService,False).sql b/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.LinqService,False).sql index 272d40ecff1..dd89f1d20eb 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.LinqService,False).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.LinqService,False).sql @@ -109,16 +109,21 @@ BeforeExecute -- SqlServer.2012 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.LinqService).sql index 95159cfe243..5a2a666c978 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.LinqService).sql index fc2b88153de..db4abad5d05 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.LinqService).sql index ad0e7cae6a8..51f8c99058f 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.LinqService).sql index 41e076e19ab..1c1c9866135 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.LinqService).sql index c2b37ae65fc..d749f154d10 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.LinqService).sql index f28d6482ac7..d186c980186 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.LinqService).sql index 7d3d529d7be..b6c332395f2 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.LinqService).sql index bd7f45b7061..8cce5e633cd 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.LinqService).sql index 89b5237c124..2a47e662144 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.LinqService).sql index 839f920ca4c..609c72aad20 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.LinqService).sql index 1dc4841858c..05685229e4c 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.LinqService).sql index 019f3b6bf98..56de88ec87f 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.LinqService).sql index fa99ed975d9..aa6e3f27cc3 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.LinqService).sql index becbaafc7d6..5e8abdf1ee6 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.LinqService).sql index 1964da4da05..be49129d58d 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.LinqService).sql index 57794c24fca..f706e4a1b0e 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.LinqService).sql index 8de29be64ce..b175d4f7034 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.LinqService).sql index e2fcca0b2d6..e63ad2ed2b4 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.LinqService).sql index b9c07960629..7c30a96afb6 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.LinqService).sql index 959e0573d68..bee2c4b76b4 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,1).sql b/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,1).sql index c636cb3620c..10cac7ab0ca 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,1).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,2).sql b/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,2).sql index 0da4cf1c8ec..63b36b36e24 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,2).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.LinqService).sql index 73678a25021..295bc5955f4 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,14).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,14).sql index 0ab1c79aa0a..ac24465af23 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,14).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,15).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,15).sql index 52901ed0596..76c283e7192 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,15).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,14).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,14).sql index 4a185d77b77..d54e8018318 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,14).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,15).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,15).sql index 7c1c6e89a15..4cf335594af 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,15).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,14).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,14).sql index e5ce814c28f..318ec55c10f 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,14).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,15).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,15).sql index 9b44d5fb5ed..de1a6bd0fd9 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,15).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,14).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,14).sql index dde68f60470..0852df04ddc 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,14).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,15).sql b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,15).sql index ab21b1206b2..9fdbdf1c11c 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,15).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.LinqService).sql index 656866aece5..664712bdf5d 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.LinqService).sql index 656866aece5..664712bdf5d 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.LinqService).sql index 656866aece5..664712bdf5d 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.LinqService).sql index 69f68562cb7..a63fda41956 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.LinqService).sql index 69f68562cb7..a63fda41956 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.LinqService).sql index 69f68562cb7..a63fda41956 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.LinqService).sql index 0a749259f5e..ad6994f2f98 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.LinqService).sql index 827af1a5d34..5fcd87a2bb9 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.LinqService).sql index e56c6318990..edae72fe84a 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql index 76ceb635262..9eb89c3e935 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql index 890b64eb8e3..254a5f9e933 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql index 98e61e0a1c2..628405b870e 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql index a18f6282036..9246c77d7c3 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql index 986d176b45d..bc44e366590 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql index 11bf583f9a2..85eeb7bcf5a 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql index fa6df06794f..2e6faa49616 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql index a68b262bc5d..42cf75a9140 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.LinqService).sql index 30b9bb4a890..a558ed38af5 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -541,13 +541,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.LinqService).sql index 63894ae9af5..3d5bbf51c46 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.LinqService).sql index 2fa49a15b2a..5d220f1a379 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.LinqService).sql index 7372cc99078..16e4023695c 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.LinqService).sql index 7372cc99078..3f21e75365e 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.LinqService).sql index 9fa49b699de..5790e177374 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.LinqService).sql index 00e7f2501d8..1d80e45ac4b 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2012 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2012.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..60b35f3577b --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2012 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..23acbd88376 --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..cf8bc9eee08 --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.LinqService).sql index 5ee0ae57a16..cf8bc9eee08 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.LinqService).sql index d82f1767ca3..ab5740a864a 100644 --- a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..2ee2c6575c1 --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..474fdb124f3 --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..ab5740a864a --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..ed816842d4f --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..5ee0ae57a16 --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.LinqService).sql new file mode 100644 index 00000000000..d82f1767ca3 --- /dev/null +++ b/SqlServer.2012.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.LinqService).sql index 4b85d83529d..5bcb4670a2d 100644 --- a/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.LinqService).sql index 3d2fd81034e..d30b4fffd52 100644 --- a/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.LinqService).sql b/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.LinqService).sql index 1118a33359e..85438e204e3 100644 --- a/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.LinqService).sql +++ b/SqlServer.2012.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS.LinqService,False).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS.LinqService,False).sql index 7eda2757fd1..695da58f2bb 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS.LinqService,False).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS.LinqService,False).sql @@ -109,16 +109,21 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS.LinqService).sql index faa6527eb81..dcb42f30649 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS.LinqService).sql index fb871da1eb4..0e8485b0a07 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS.LinqService).sql index 69cc5169eee..2533dd540b1 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS.LinqService).sql index baf70b794c4..40dfde155c4 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS.LinqService).sql index 2e13ac056c9..b65cfe84bb8 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS.LinqService).sql index e5a92e7c5fa..c901e8bb570 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS.LinqService).sql index 57199bfee61..fd6b56de3d7 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS.LinqService).sql index 52db1cebfbc..bfbe4a90174 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS.LinqService).sql index 45915728122..0f04d86e3a6 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS.LinqService).sql index 69ce6190b6f..0ff20676965 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS.LinqService).sql index 93b01c560bf..aa3bf93f82a 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS.LinqService).sql index 256afd7f97a..0b5a33f2ac4 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS.LinqService).sql index 3345d307d1e..ff779bad25a 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS.LinqService).sql index 1c856492007..14140a90626 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS.LinqService).sql index 3cfdf7b5308..229dd542fb7 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS.LinqService).sql index dbda522b78c..bc983d64983 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS.LinqService).sql index 07b8b6245b5..fe8310956ad 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS.LinqService).sql index 74963f5926d..c4691331370 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS.LinqService).sql index c8639a71f4e..28778e15b15 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS.LinqService).sql index 9243140ae32..93b4626c110 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,1).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,1).sql index d76bf5a86d4..6ff0c349dde 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,1).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,2).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,2).sql index 023162cda1a..e15ec6aa7a6 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,2).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS.LinqService).sql index 45b2a8de8c9..3010ed502ec 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,14).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,14).sql index dd354bc6769..3a32616e1b5 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,14).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,15).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,15).sql index 39d100a347e..cba570506cb 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,15).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,14).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,14).sql index 405af1041c7..dce22a9aaf4 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,14).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,15).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,15).sql index 9d9c27169bf..73fe9585725 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,15).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,14).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,14).sql index 138e0ee03aa..3770af0032f 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,14).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,15).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,15).sql index 851929d9da0..352f57c539a 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,15).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,14).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,14).sql index 4bc2575da65..c536e63d6c4 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,14).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,15).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,15).sql index 5f91bc2648e..a2aacdf1a1f 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,15).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS.LinqService).sql index f6c366dacdb..8185405bc2a 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS.LinqService).sql index f6c366dacdb..8185405bc2a 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS.LinqService).sql index f6c366dacdb..8185405bc2a 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS.LinqService).sql index 20464e63ebd..3c3d594ff31 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS.LinqService).sql index 20464e63ebd..3c3d594ff31 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS.LinqService).sql index 20464e63ebd..3c3d594ff31 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS.LinqService).sql index a44fbd82d17..b1e32e099f5 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS.LinqService).sql index 9708eab11ee..f0c0436a5e4 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS.LinqService).sql index d744a070b06..a26965f1456 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql index 77d23fda41f..8377666c7ad 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql index 995e271de5e..eb810f21a6d 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql index b2de3242633..7fadaa71d63 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql index 16d40e39c69..9b717a68562 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql index 92cc01be14c..74bb356fe0b 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql index 09586bdbc68..163753b17ab 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql index e6a8c392c60..e3adb5c2d4f 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql index 0918b3e668a..b0ed8303ce8 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS.LinqService).sql index 85a5ecc8b69..bb1dff19067 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -541,13 +541,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS.LinqService).sql index b84a7803fd3..8409595ac29 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS.LinqService).sql index 50ea71ee209..54ae5fc80ab 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS.LinqService).sql index 3bef6782b61..9d532e6a58d 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS.LinqService).sql index 3bef6782b61..952bcd6b2ed 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS.LinqService).sql index ae1086f2333..7cbfa395c94 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS.LinqService).sql index abf9c6a5250..5ed3f4ecd48 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..702092228d0 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..119490d57d2 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..bced805cb14 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS.LinqService).sql index cd5f280bc57..bced805cb14 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS.LinqService).sql index 17993ef3b05..27100114ff7 100644 --- a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..c5f1d030dc5 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..d34ccdd37c9 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..27100114ff7 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..01729fa9226 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..cd5f280bc57 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.MS.LinqService).sql new file mode 100644 index 00000000000..17993ef3b05 --- /dev/null +++ b/SqlServer.2012.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS.LinqService).sql index 3490270c50a..93a13a95be9 100644 --- a/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS.LinqService).sql index 3ad32053085..e372d0d0be5 100644 --- a/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS.LinqService).sql b/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS.LinqService).sql index 765d8477f73..651ddce7fd0 100644 --- a/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS.LinqService).sql +++ b/SqlServer.2012.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012.MS).sql index 1e6f47ae1e0..3cec70b1416 100644 --- a/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012.MS).sql index 1e6f47ae1e0..3cec70b1416 100644 --- a/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012.MS).sql index b692eba91db..67445e43ae0 100644 --- a/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS,False).sql b/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS,False).sql index ad9d1c7efcf..8737f84081f 100644 --- a/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS,False).sql +++ b/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012.MS,False).sql @@ -36,16 +36,21 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS).sql index faa6527eb81..dcb42f30649 100644 --- a/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012.MS).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS).sql index 2548ba3184c..7ff30e5ff4b 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS).sql index 474f6fd3a3c..c359d38c94f 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS).sql index b6ba98fd306..66a5f4f6deb 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS).sql index 4105e65be90..ffbac26dbed 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS).sql index e259ee0779a..8be39fc1fdf 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS).sql index 3d7874c9b89..efc09729ad5 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS).sql index 71d642cb344..793a1b06891 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS).sql index 574570acd60..436e345376b 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS).sql index 3ba5e76ce71..c95b1b09d5e 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS).sql index e2f28bebf0e..32e839fe7ce 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS).sql index 7f498d588c3..b0b7029bd4c 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS).sql index 45e6d7fd46f..608b8b85563 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS).sql index d552f667bf5..cc5c399d0e0 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS).sql index 7c910ea4291..ac235618f43 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS).sql index f72e68cde47..b5227667b5b 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS).sql index b29993a6e71..59238d8b0e2 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS).sql index 2232287a55a..6f744e6dff0 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS).sql index 2c2b72d050f..2fc0b2b09f1 100644 --- a/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS).sql index 9243140ae32..93b4626c110 100644 --- a/SqlServer.2012.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,1).sql b/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,1).sql index d76bf5a86d4..6ff0c349dde 100644 --- a/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,1).sql +++ b/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,2).sql b/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,2).sql index 023162cda1a..e15ec6aa7a6 100644 --- a/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,2).sql +++ b/SqlServer.2012.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS).sql index 45b2a8de8c9..3010ed502ec 100644 --- a/SqlServer.2012.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012.MS).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,14).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,14).sql index b466ed96657..cfbb978da2f 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,14).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,15).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,15).sql index 468a3bede44..8fbded88c9d 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,15).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,14).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,14).sql index e3aef27ef39..0914026ee36 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,14).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,15).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,15).sql index 34e2d783e37..90f79d9a6e3 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,15).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,14).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,14).sql index 033d0d5a5db..ce79d20f536 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,14).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,15).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,15).sql index 0cb52e806a8..bb9b0a9bfe9 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,15).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,14).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,14).sql index 02a794e1395..a3cd8143c8b 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,14).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,15).sql b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,15).sql index 41c06942aee..72728a837b0 100644 --- a/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,15).sql +++ b/SqlServer.2012.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS).sql index f6c366dacdb..8185405bc2a 100644 --- a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS).sql index f6c366dacdb..8185405bc2a 100644 --- a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS).sql index f6c366dacdb..8185405bc2a 100644 --- a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS).sql index 20464e63ebd..3c3d594ff31 100644 --- a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS).sql index 20464e63ebd..3c3d594ff31 100644 --- a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS).sql index 20464e63ebd..3c3d594ff31 100644 --- a/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012.MS).sql index 94e1c3562db..d0de5525dcd 100644 --- a/SqlServer.2012.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS).sql index a44fbd82d17..b1e32e099f5 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS).sql index 9708eab11ee..f0c0436a5e4 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS).sql index d744a070b06..a26965f1456 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql index 77d23fda41f..8377666c7ad 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql index 995e271de5e..eb810f21a6d 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql index b2de3242633..7fadaa71d63 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql index 16d40e39c69..9b717a68562 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql index 92cc01be14c..74bb356fe0b 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql index 09586bdbc68..163753b17ab 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql index e6a8c392c60..e3adb5c2d4f 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql index 0918b3e668a..b0ed8303ce8 100644 --- a/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS).sql index eb2307ec305..1121d5ce407 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012.MS).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -103,13 +103,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS).sql index f587282c421..6b8a131e785 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012.MS).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS).sql index 50ea71ee209..54ae5fc80ab 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS).sql index 3bef6782b61..9d532e6a58d 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS).sql index 3bef6782b61..952bcd6b2ed 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS).sql index ae1086f2333..7cbfa395c94 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS).sql index abf9c6a5250..5ed3f4ecd48 100644 --- a/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..797f57b05bd --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012.MS).sql @@ -0,0 +1,68 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012.MS).sql index 00ee61b68ba..b390566e1b2 100644 --- a/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..119490d57d2 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..bced805cb14 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS).sql index cd5f280bc57..bced805cb14 100644 --- a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS).sql index 17993ef3b05..27100114ff7 100644 --- a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2012.MS SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..c5f1d030dc5 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..d34ccdd37c9 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..27100114ff7 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..01729fa9226 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..cd5f280bc57 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.MS).sql new file mode 100644 index 00000000000..17993ef3b05 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 03).sql b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 03).sql index dbfda6e6560..dd46708b46e 100644 --- a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 03).sql +++ b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 03).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 04).sql b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 04).sql index 1de53b11dd8..ce9e490c2ae 100644 --- a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 04).sql +++ b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 04).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 05).sql b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 05).sql index fb5faf930af..f03f51c89d8 100644 --- a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 05).sql +++ b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 05).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 06).sql b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 06).sql index 9d54df915cf..5601e122559 100644 --- a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 06).sql +++ b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 06).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 07).sql b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 07).sql index 43c5441345d..1614cd36f05 100644 --- a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 07).sql +++ b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 07).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 12).sql b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 12).sql index 5173db760a0..d98fe0af5d5 100644 --- a/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 12).sql +++ b/SqlServer.2012.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012.MS,Query 12).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012.MS SqlServer.2012 diff --git a/SqlServer.2012.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012.MS).sql index 3d7c2d0da6a..6d30f9f9717 100644 --- a/SqlServer.2012.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012.MS).sql @@ -86,21 +86,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -122,10 +122,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2012.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012.MS).sql index 833da527a50..e676bfeff57 100644 --- a/SqlServer.2012.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012.MS).sql @@ -130,7 +130,7 @@ BeforeExecute -- SqlServer.2012.MS SqlServer.2012 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -160,7 +160,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -238,7 +238,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS).sql index 3490270c50a..93a13a95be9 100644 --- a/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS).sql index 3ad32053085..e372d0d0be5 100644 --- a/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS).sql index 765d8477f73..651ddce7fd0 100644 --- a/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS).sql +++ b/SqlServer.2012.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012).sql index bf56115f2f3..20c10549f7c 100644 --- a/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2012).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012).sql index bf56115f2f3..20c10549f7c 100644 --- a/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2012).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012).sql index b1b4f8bcf47..7c5e8b68ec0 100644 --- a/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2012).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012,False).sql b/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012,False).sql index d26ecad2e61..a927564a200 100644 --- a/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012,False).sql +++ b/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2012,False).sql @@ -36,16 +36,21 @@ BeforeExecute -- SqlServer.2012 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012).sql index 95159cfe243..5a2a666c978 100644 --- a/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2012).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012).sql index 6b95fa4744e..968c7be90ec 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012).sql index 6461b3ce269..ccbb19cc731 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012).sql index 86262205cf5..3c4c0714a29 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012).sql index 961e12889f9..478bf2b0c4d 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012).sql index 03cf56561a2..3c3f712a795 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012).sql index da45f5aac5d..15480c12ca0 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012).sql index e68acdc19d4..1dc71c980c8 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012).sql index 9c7f3faba57..30486f3b156 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012).sql index 69ed8014818..b344bd7e82f 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012).sql index 81e33f4fabe..07cde793614 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012).sql index 1c2c6bf5c91..f85d761325b 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012).sql index 6a91c51fd4e..c00c2577b04 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012).sql index 2aee8dc93b2..1c814b69fe0 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012).sql index 33eda44a6ca..cde904074b4 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012).sql index fdfc4368703..c70cfdfa277 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012).sql index aab68bf4cfa..087ad7f6653 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012).sql index 4a617f74632..3366ee92211 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012).sql index eb868c33fcc..12e84bc7b46 100644 --- a/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2012).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012).sql index 959e0573d68..bee2c4b76b4 100644 --- a/SqlServer.2012/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2012).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,1).sql b/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,1).sql index c636cb3620c..10cac7ab0ca 100644 --- a/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,1).sql +++ b/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,2).sql b/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,2).sql index 0da4cf1c8ec..63b36b36e24 100644 --- a/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,2).sql +++ b/SqlServer.2012/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2012,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2012/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012).sql index 73678a25021..295bc5955f4 100644 --- a/SqlServer.2012/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2012).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,14).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,14).sql index 77e4784fb20..57a497c2e6a 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,14).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,15).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,15).sql index 767fcec057b..e98663fd8df 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,15).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2012,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,14).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,14).sql index 6089883e92c..864ec342fab 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,14).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,15).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,15).sql index c53ab3f6591..05095032974 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,15).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2012,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,14).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,14).sql index 955378c65ca..624f7712f08 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,14).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,15).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,15).sql index 87d7e76e25a..d04d4005c9a 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,15).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2012,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,14).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,14).sql index 6ec5b03f9cc..36a90d6d7b8 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,14).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,15).sql b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,15).sql index 63f412b5d01..13e03fc31fb 100644 --- a/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,15).sql +++ b/SqlServer.2012/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2012,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012).sql index 656866aece5..664712bdf5d 100644 --- a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2012).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012).sql index 656866aece5..664712bdf5d 100644 --- a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2012).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012).sql index 656866aece5..664712bdf5d 100644 --- a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2012).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012).sql index 69f68562cb7..a63fda41956 100644 --- a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2012).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012).sql index 69f68562cb7..a63fda41956 100644 --- a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2012).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012).sql index 69f68562cb7..a63fda41956 100644 --- a/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2012).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2012/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012).sql index 1ea9fa12383..25c809aa358 100644 --- a/SqlServer.2012/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2012).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012).sql index 0a749259f5e..ad6994f2f98 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2012).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012).sql index 827af1a5d34..5fcd87a2bb9 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2012).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012).sql index e56c6318990..edae72fe84a 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2012).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql index 76ceb635262..9eb89c3e935 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql index 890b64eb8e3..254a5f9e933 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql @@ -2,13 +2,13 @@ -- SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql index 98e61e0a1c2..628405b870e 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql index a18f6282036..9246c77d7c3 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql index 986d176b45d..bc44e366590 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2012).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql index 11bf583f9a2..85eeb7bcf5a 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2012).sql @@ -2,13 +2,13 @@ -- SqlServer.2012 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql index fa6df06794f..2e6faa49616 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2012).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql index a68b262bc5d..42cf75a9140 100644 --- a/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2012).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012).sql index 7a0b161c5d0..d2aab993701 100644 --- a/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2012).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -103,13 +103,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012).sql index 71a6061790b..095da193776 100644 --- a/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2012).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012).sql index 2fa49a15b2a..5d220f1a379 100644 --- a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2012).sql @@ -2,11 +2,11 @@ -- SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012).sql index 7372cc99078..16e4023695c 100644 --- a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2012).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012).sql index 7372cc99078..3f21e75365e 100644 --- a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2012).sql @@ -2,11 +2,11 @@ -- SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012).sql index 9fa49b699de..5790e177374 100644 --- a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2012).sql @@ -2,11 +2,11 @@ -- SqlServer.2012 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012).sql index 00e7f2501d8..1d80e45ac4b 100644 --- a/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2012).sql @@ -2,11 +2,18 @@ -- SqlServer.2012 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012).sql new file mode 100644 index 00000000000..35e6bd525a9 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2012).sql @@ -0,0 +1,68 @@ +BeforeExecute +-- SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2012 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2012 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2012 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2012 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012).sql index 2a146bb4df4..b60580cd253 100644 --- a/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2012).sql @@ -2,38 +2,28 @@ -- SqlServer.2012 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012).sql new file mode 100644 index 00000000000..23acbd88376 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2012).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012).sql new file mode 100644 index 00000000000..cf8bc9eee08 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2012).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012).sql index 5ee0ae57a16..cf8bc9eee08 100644 --- a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2012).sql @@ -2,17 +2,10 @@ -- SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012).sql index d82f1767ca3..ab5740a864a 100644 --- a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2012).sql @@ -2,14 +2,10 @@ -- SqlServer.2012 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012).sql new file mode 100644 index 00000000000..2ee2c6575c1 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2012).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012).sql new file mode 100644 index 00000000000..474fdb124f3 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2012).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012).sql new file mode 100644 index 00000000000..ab5740a864a --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2012).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012).sql new file mode 100644 index 00000000000..ed816842d4f --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2012).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012).sql new file mode 100644 index 00000000000..5ee0ae57a16 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2012).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012).sql new file mode 100644 index 00000000000..d82f1767ca3 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2012).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2012 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 03).sql b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 03).sql index 2bc482082d2..c515e4c74af 100644 --- a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 03).sql +++ b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 03).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 04).sql b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 04).sql index fb98ece1985..7e2ae323a43 100644 --- a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 04).sql +++ b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 04).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 05).sql b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 05).sql index ee3e5551671..c4b25f1024e 100644 --- a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 05).sql +++ b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 05).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 06).sql b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 06).sql index a8394e4bb10..d176a61a775 100644 --- a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 06).sql +++ b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 06).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 07).sql b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 07).sql index 5a58b8fb494..5a20721bc9a 100644 --- a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 07).sql +++ b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 07).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 12).sql b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 12).sql index 3ca56c3f308..9452a97b868 100644 --- a/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 12).sql +++ b/SqlServer.2012/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2012,Query 12).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2012 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2012 diff --git a/SqlServer.2012/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012).sql b/SqlServer.2012/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012).sql index c3e301b73a7..682404e2999 100644 --- a/SqlServer.2012/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2012).sql @@ -86,21 +86,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -122,10 +122,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2012/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012).sql b/SqlServer.2012/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012).sql index cbb587c1304..43aedf47c41 100644 --- a/SqlServer.2012/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2012).sql @@ -130,7 +130,7 @@ BeforeExecute -- SqlServer.2012 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -160,7 +160,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -238,7 +238,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012).sql b/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012).sql index 4b85d83529d..5bcb4670a2d 100644 --- a/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2012).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012).sql b/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012).sql index 3d2fd81034e..d30b4fffd52 100644 --- a/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2012).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012).sql b/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012).sql index 1118a33359e..85438e204e3 100644 --- a/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012).sql +++ b/SqlServer.2012/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2012).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.LinqService,False).sql b/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.LinqService,False).sql index d61b8bc594d..ae2a701d7d4 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.LinqService,False).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.LinqService,False).sql @@ -109,16 +109,21 @@ BeforeExecute -- SqlServer.2014 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.LinqService).sql index adc8eaf52a7..1b0e1e7c48a 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.LinqService).sql index 00117a09e82..dfee20539c9 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.LinqService).sql index 8cfda602bb5..5f12fa28632 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.LinqService).sql index 0826661ac7d..ba3518dff25 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.LinqService).sql index da047595013..7dbdb653cc5 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.LinqService).sql index 627f2c75b99..c79a479a201 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.LinqService).sql index f11ad2f5946..6f295da28ad 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.LinqService).sql index 863e3103455..25991da4164 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.LinqService).sql index 73d246cf5e4..1dc09700696 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.LinqService).sql index 583996788f5..3b72888c2cf 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.LinqService).sql index 29f6ff4a6e4..64de5aeab0e 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.LinqService).sql index da8d831265f..c324d0be674 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.LinqService).sql index 9352980f9ba..02a7df76c4e 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.LinqService).sql index a6ef8794da1..818521bb851 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.LinqService).sql index 7be904d584f..f633d72a5fc 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.LinqService).sql index e634c57c5f4..b4d8335233f 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.LinqService).sql index b17c8cfea42..91989dad8e1 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.LinqService).sql index 85cf09d1d17..27efc491661 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.LinqService).sql index 215d3b10931..fb742f0da8d 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.LinqService).sql index c91dba3786e..cf5704259cc 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,1).sql b/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,1).sql index 71b78491b76..2c483a1245e 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,1).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,2).sql b/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,2).sql index b089bc16827..575a459f445 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,2).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.LinqService).sql index 9bf17a7b0a4..7bd6341ffa0 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,14).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,14).sql index 42477840b26..4d4abb31e37 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,14).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,15).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,15).sql index 72ae9ba8d3a..011e354bffe 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,15).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,14).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,14).sql index f7c5cfc9386..923c3811ff5 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,14).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,15).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,15).sql index 28f14eb911c..e57ad573ec5 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,15).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,14).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,14).sql index ff1c7629276..f3f1b1506be 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,14).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,15).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,15).sql index 40671b233a2..ce9e4037217 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,15).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,14).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,14).sql index ba842f073c2..dc2b9352cc6 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,14).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,15).sql b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,15).sql index 11051a308db..df47d560032 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,15).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.LinqService).sql index e3126909e2a..a7a67aa019d 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.LinqService).sql index e3126909e2a..a7a67aa019d 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.LinqService).sql index e3126909e2a..a7a67aa019d 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.LinqService).sql index a5a6e7fffd1..7f8ff604822 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.LinqService).sql index a5a6e7fffd1..7f8ff604822 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.LinqService).sql index a5a6e7fffd1..7f8ff604822 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.LinqService).sql index 6bd4b95c51a..4c48da97fce 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.LinqService).sql index 602df40c9cb..2611acf7897 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.LinqService).sql index e4f06c4b726..9bb1a035c99 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql index 556bb20e6d5..bd69c9835d4 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql index 250134c748f..15483aa3820 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql index 7ab825dce49..be4df41ecda 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql index 760ffd6b582..4e7904e4d47 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql index aa1031dbc9e..8e152c67793 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql index 45aad3e2cc6..ab6f0a492c8 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql index fe2335da51a..50f241bde00 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql index 7b719657a2f..264f023e795 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.LinqService).sql index ef400845705..91eb75c6bee 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -541,13 +541,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.LinqService).sql index f6ee747defb..aad991bca7a 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.LinqService).sql index b5661c92a8e..3a0ac302570 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.LinqService).sql index 9c957becf02..b9747146849 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.LinqService).sql index 9c957becf02..c5bfb341c1b 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.LinqService).sql index 67e54ca15c2..ca20b4215d1 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.LinqService).sql index 099ccc00876..30786fae1cd 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2014 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2014.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..30778624ec7 --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2014 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..dea0213834d --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..0924c981a16 --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.LinqService).sql index d2f94b5b56e..0924c981a16 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.LinqService).sql index 0a1e22b0f24..481231f5e1d 100644 --- a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..f7734129a49 --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..9a4fdadba4f --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..481231f5e1d --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..3d5b9dc6c16 --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..d2f94b5b56e --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.LinqService).sql new file mode 100644 index 00000000000..0a1e22b0f24 --- /dev/null +++ b/SqlServer.2014.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.LinqService).sql index 265474b38e4..305b6ada1a0 100644 --- a/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.LinqService).sql index 02c9b4ea904..df9f58ff0a0 100644 --- a/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.LinqService).sql b/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.LinqService).sql index f4d9268e73a..972ea5e480d 100644 --- a/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.LinqService).sql +++ b/SqlServer.2014.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS.LinqService,False).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS.LinqService,False).sql index 04316450067..5e242ca9dac 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS.LinqService,False).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS.LinqService,False).sql @@ -109,16 +109,21 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS.LinqService).sql index 79661be34e4..075797e5868 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS.LinqService).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS.LinqService).sql index 9c48cbfb7b0..6c7c2ca1126 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS.LinqService).sql index 16246532a36..39ca442976c 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS.LinqService).sql index e5fe30500ab..c324e10dd8b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS.LinqService).sql index 261b12d6bba..f55da556ad3 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS.LinqService).sql index 61399355a3f..28baf5b79b7 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS.LinqService).sql index 4cac89b0038..b06eae131bf 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS.LinqService).sql index 03e2a9e9f82..35bf113b14a 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS.LinqService).sql index 5535751e6b6..e76b3eceb16 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS.LinqService).sql index 82301c39a1c..6670428f6de 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS.LinqService).sql index 91a78620c06..9ab06399923 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS.LinqService).sql index 9deb4974aa7..2b71584fb93 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS.LinqService).sql index f76ebcd7c59..331fab06038 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS.LinqService).sql index c9688129403..042f311a2a4 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS.LinqService).sql index 1503b414d4f..4b23e6be581 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS.LinqService).sql index 668b2d9b0f3..48e5345770c 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS.LinqService).sql index fa6a16fcc15..c9a7e37999c 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS.LinqService).sql index 18eb6e14d9d..7326e05a262 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS.LinqService).sql index ea57471ed17..41ffb06047e 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS.LinqService).sql @@ -488,7 +488,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -496,11 +496,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS.LinqService).sql index 995e26254f6..4610254722b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,1).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,1).sql index 4339ef8d477..91d0977e3e3 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,1).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,2).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,2).sql index 557db19bb25..a182c11e485 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,2).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS.LinqService).sql index 1240984a176..3fa31c3abaa 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS.LinqService).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,14).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,14).sql index 6ed393a25b2..4909d73f974 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,14).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,15).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,15).sql index 86731697896..014c183be09 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,15).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,14).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,14).sql index 0d6e0e37679..f45e5f31a7f 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,14).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,15).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,15).sql index 1cb4de212f9..43399c1c05f 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,15).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,14).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,14).sql index 69df3a44e45..bd0c9d2712d 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,14).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,15).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,15).sql index 2ff36053dcb..5c0fd030335 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,15).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,14).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,14).sql index aa3271375f0..211e128a73c 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,14).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,14).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,15).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,15).sql index ad79f391b9d..ffbf6181d0e 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,15).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS.LinqService,15).sql @@ -385,10 +385,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS.LinqService).sql index 5e6015b6900..51b71e9d89b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS.LinqService).sql index 5e6015b6900..51b71e9d89b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS.LinqService).sql index 5e6015b6900..51b71e9d89b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS.LinqService).sql index bd05959b809..7113d2b2b3b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS.LinqService).sql index bd05959b809..7113d2b2b3b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS.LinqService).sql index bd05959b809..7113d2b2b3b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS.LinqService).sql index f63657c1fe9..802bc75536e 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS.LinqService).sql index 5be38987a12..0a844aac837 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS.LinqService).sql index 316722a97a4..60e52fe4f0a 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql index 6c0e618d77a..9b7b0bc17b2 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql index 4a4eacac178..988509973e9 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql index 748a558b949..3089460e976 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql index c61bedd9539..ce2d49ed1d4 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql index 761e796cbd4..5a81c5a187d 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql index f9fef46ddec..25bcf661086 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql index 855be3506a0..c1fb7c52495 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql index d44b7654632..08a38846b0b 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS.LinqService).sql index a440745393a..abb12ca3eba 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -541,13 +541,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS.LinqService).sql index adfd20610ee..be159e445ce 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS.LinqService).sql @@ -509,13 +509,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS.LinqService).sql index 87b97f0a968..18fea217f74 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS.LinqService).sql index 3ee6eef1a15..a491352c281 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS.LinqService).sql index 3ee6eef1a15..b730bb97bbf 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS.LinqService).sql index 082b490ddf9..7b3c6c4b1c1 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS.LinqService).sql index ba994a52797..87ee9646774 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..ad081bbc2a3 --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,156 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..77eec93b8f5 --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..43703182dab --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS.LinqService).sql index 150c6cb660b..43703182dab 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS.LinqService).sql index 63c4bc06803..8de8ee1d91d 100644 --- a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..2539d1b27f7 --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..ff1e7edba3e --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..8de8ee1d91d --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..a9f5623d453 --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..150c6cb660b --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.MS.LinqService).sql new file mode 100644 index 00000000000..63c4bc06803 --- /dev/null +++ b/SqlServer.2014.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS.LinqService).sql index 01f2d4a9e5b..5bf387f7821 100644 --- a/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS.LinqService).sql index f42d9392286..8335d093102 100644 --- a/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS.LinqService).sql b/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS.LinqService).sql index 0c1d34448d3..cf3bd0d8635 100644 --- a/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS.LinqService).sql +++ b/SqlServer.2014.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014.MS).sql index c864225ceb3..46f3e16d033 100644 --- a/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014.MS).sql index c864225ceb3..46f3e16d033 100644 --- a/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014.MS).sql index 2024d1d8b55..36ba75fd609 100644 --- a/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS,False).sql b/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS,False).sql index 02d7c9395e1..899c3c03aab 100644 --- a/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS,False).sql +++ b/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014.MS,False).sql @@ -36,16 +36,21 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS).sql index 79661be34e4..075797e5868 100644 --- a/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014.MS).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS).sql index ef27148ef50..f1e882fa403 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS).sql index 64199f03e63..73d805f0564 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS).sql index 7e05fafd4b6..3807616987e 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS).sql index 9ca109ec651..7f7655da11c 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS).sql index 5b87f01312e..26b4d3d7809 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS).sql index ad327c8b9f7..a7d3688c892 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS).sql index ff12495b54a..6e0c1d12f2f 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS).sql index 2aff8889b31..ec03bdb5ed6 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS).sql index 7e6c627512f..be90b14f60b 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS).sql index 70ede494869..1d56683de50 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS).sql index 278042e9e85..eb66608b794 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS).sql index fd79d76ca48..0b5283497c4 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS).sql index 0dca7d75d8d..618b7827786 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS).sql index 2900a079787..5491c2d42c8 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS).sql index 0c6d691af24..dcde4f9b285 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS).sql index 326318e68f6..6cd4d9a29f2 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS).sql index 3ba06b22100..20a996ef476 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS).sql index 2c9fdc14de3..24a9392f59b 100644 --- a/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014.MS).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS).sql index 995e26254f6..4610254722b 100644 --- a/SqlServer.2014.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,1).sql b/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,1).sql index 4339ef8d477..91d0977e3e3 100644 --- a/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,1).sql +++ b/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,2).sql b/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,2).sql index 557db19bb25..a182c11e485 100644 --- a/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,2).sql +++ b/SqlServer.2014.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS).sql index 1240984a176..3fa31c3abaa 100644 --- a/SqlServer.2014.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014.MS).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,14).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,14).sql index c2326690b5f..96c169ce373 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,14).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,15).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,15).sql index 2c5e763d73e..da24016a530 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,15).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,14).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,14).sql index ce1741e322e..badca4ce408 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,14).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,15).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,15).sql index fbee0110f15..6aa1cd9263f 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,15).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,14).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,14).sql index 7b9caae4d4c..a3fc19674cb 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,14).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,15).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,15).sql index d89868311bf..0991d23eea6 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,15).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,14).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,14).sql index f3e01c7d0ed..972a708e5da 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,14).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,15).sql b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,15).sql index 516b0454fd3..2bdc962a143 100644 --- a/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,15).sql +++ b/SqlServer.2014.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014.MS,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS).sql index 5e6015b6900..51b71e9d89b 100644 --- a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS).sql index 5e6015b6900..51b71e9d89b 100644 --- a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS).sql index 5e6015b6900..51b71e9d89b 100644 --- a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS).sql index bd05959b809..7113d2b2b3b 100644 --- a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS).sql index bd05959b809..7113d2b2b3b 100644 --- a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS).sql index bd05959b809..7113d2b2b3b 100644 --- a/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014.MS).sql index d539681e208..b0e55bf2641 100644 --- a/SqlServer.2014.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS).sql index f63657c1fe9..802bc75536e 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS).sql index 5be38987a12..0a844aac837 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS).sql index 316722a97a4..60e52fe4f0a 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql index 6c0e618d77a..9b7b0bc17b2 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql index 4a4eacac178..988509973e9 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql index 748a558b949..3089460e976 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql index c61bedd9539..ce2d49ed1d4 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql index 761e796cbd4..5a81c5a187d 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql index f9fef46ddec..25bcf661086 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql index 855be3506a0..c1fb7c52495 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql index d44b7654632..08a38846b0b 100644 --- a/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS).sql index b35eed02ff1..05091062432 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014.MS).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -103,13 +103,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS).sql index bb9f3a27310..d0555f35918 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014.MS).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS).sql index 87b97f0a968..18fea217f74 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS).sql index 3ee6eef1a15..a491352c281 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS).sql index 3ee6eef1a15..b730bb97bbf 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS).sql index 082b490ddf9..7b3c6c4b1c1 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS).sql index ba994a52797..87ee9646774 100644 --- a/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..e940d476991 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014.MS).sql @@ -0,0 +1,68 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014.MS).sql index a0a092de5cd..a5aa760b164 100644 --- a/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..77eec93b8f5 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..43703182dab --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS).sql index 150c6cb660b..43703182dab 100644 --- a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS).sql index 63c4bc06803..8de8ee1d91d 100644 --- a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2014.MS SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..2539d1b27f7 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..ff1e7edba3e --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..8de8ee1d91d --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..a9f5623d453 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..150c6cb660b --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.MS).sql new file mode 100644 index 00000000000..63c4bc06803 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 03).sql b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 03).sql index 109d4af8735..989eb4f9e8f 100644 --- a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 03).sql +++ b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 03).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 04).sql b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 04).sql index 9a8ca1511ba..220c472ad09 100644 --- a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 04).sql +++ b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 04).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 05).sql b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 05).sql index ab4e344c002..e05aa1ab932 100644 --- a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 05).sql +++ b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 05).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 06).sql b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 06).sql index 018a305a21c..3136bdcc3ec 100644 --- a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 06).sql +++ b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 06).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 07).sql b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 07).sql index c3bba76a90b..418625fb43d 100644 --- a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 07).sql +++ b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 07).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 12).sql b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 12).sql index 16b5f7590be..f95b14d07aa 100644 --- a/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 12).sql +++ b/SqlServer.2014.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014.MS,Query 12).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014.MS SqlServer.2014 diff --git a/SqlServer.2014.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014.MS).sql index 0da0c2e1f45..649ccd12bec 100644 --- a/SqlServer.2014.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014.MS).sql @@ -86,21 +86,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -122,10 +122,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2014.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014.MS).sql index 8900849cd8a..54fa1e4cbed 100644 --- a/SqlServer.2014.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014.MS).sql @@ -130,7 +130,7 @@ BeforeExecute -- SqlServer.2014.MS SqlServer.2014 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -160,7 +160,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -238,7 +238,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS).sql index 01f2d4a9e5b..5bf387f7821 100644 --- a/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS).sql index f42d9392286..8335d093102 100644 --- a/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS).sql index 0c1d34448d3..cf3bd0d8635 100644 --- a/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS).sql +++ b/SqlServer.2014.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014).sql index 13459923d2b..96c8b472337 100644 --- a/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2014).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014).sql index 13459923d2b..96c8b472337 100644 --- a/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2014).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014).sql index d90c2b208bc..bd445f8aa4e 100644 --- a/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2014).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014,False).sql b/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014,False).sql index 5a22dcfd6b2..a154e7d0b59 100644 --- a/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014,False).sql +++ b/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2014,False).sql @@ -36,16 +36,21 @@ BeforeExecute -- SqlServer.2014 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014).sql index adc8eaf52a7..1b0e1e7c48a 100644 --- a/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2014).sql @@ -69,10 +69,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014).sql index 8b3c09a0532..ae6c3ef2ea2 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014).sql index d75b2ad65f9..cf7f42a0de6 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014).sql index 6b8fb0e181c..2aaf76fc226 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014).sql index 069242b2b27..b802ba4d50b 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014).sql index 4c76bc978ec..a169558fa4a 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014).sql index 374d6591c60..fc3389fb722 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014).sql index 60b474e999b..7baa2d7783a 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014).sql index 4afb1706759..9aab43df890 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014).sql index 5fab6deead5..1c8412aaed7 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014).sql index 93f43a85c42..c31e75324d8 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014).sql index c38ec8247cf..fffabe0def1 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014).sql index fecd6113d81..6afcebcfc10 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014).sql index 137be5b580e..c3790ecbda6 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014).sql index 5e8d48b7ac1..50203023c45 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014).sql index d030fb94cb8..69192f80b67 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014).sql index f9ad1bc775a..4150aff147f 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014).sql index 8d2096f9cdc..dbd8fb77793 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014).sql index da561a16fe7..9b076a0c5c8 100644 --- a/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2014).sql @@ -56,7 +56,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -64,11 +64,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014).sql index c91dba3786e..cf5704259cc 100644 --- a/SqlServer.2014/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2014).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,1).sql b/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,1).sql index 71b78491b76..2c483a1245e 100644 --- a/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,1).sql +++ b/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,2).sql b/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,2).sql index b089bc16827..575a459f445 100644 --- a/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,2).sql +++ b/SqlServer.2014/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2014,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2014/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014).sql index 9bf17a7b0a4..7bd6341ffa0 100644 --- a/SqlServer.2014/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2014).sql @@ -21,8 +21,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,14).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,14).sql index 50ea37f0bf2..3e159ba6b27 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,14).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,15).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,15).sql index 8160939f250..024b68be607 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,15).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2014,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,14).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,14).sql index 8bf06f64020..60a6a99875d 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,14).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,15).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,15).sql index 7d3de058948..1337d25bd9e 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,15).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2014,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,14).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,14).sql index c87978a140c..0031f6f8ddb 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,14).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,15).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,15).sql index c8f7e79b097..996d715ef85 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,15).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2014,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,14).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,14).sql index 81e03d3948e..634ca7490a2 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,14).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,14).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,15).sql b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,15).sql index 64bdd20ab29..095f0547ee0 100644 --- a/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,15).sql +++ b/SqlServer.2014/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2014,15).sql @@ -55,10 +55,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014).sql index e3126909e2a..a7a67aa019d 100644 --- a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2014).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014).sql index e3126909e2a..a7a67aa019d 100644 --- a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2014).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014).sql index e3126909e2a..a7a67aa019d 100644 --- a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2014).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014).sql index a5a6e7fffd1..7f8ff604822 100644 --- a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2014).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014).sql index a5a6e7fffd1..7f8ff604822 100644 --- a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2014).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014).sql index a5a6e7fffd1..7f8ff604822 100644 --- a/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2014).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2014/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014).sql index 73e15ee8830..c33e9e03c77 100644 --- a/SqlServer.2014/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2014).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014).sql index 6bd4b95c51a..4c48da97fce 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2014).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014).sql index 602df40c9cb..2611acf7897 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2014).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014).sql index e4f06c4b726..9bb1a035c99 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2014).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql index 556bb20e6d5..bd69c9835d4 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql index 250134c748f..15483aa3820 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql @@ -2,13 +2,13 @@ -- SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql index 7ab825dce49..be4df41ecda 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql index 760ffd6b582..4e7904e4d47 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql index aa1031dbc9e..8e152c67793 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2014).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql index 45aad3e2cc6..ab6f0a492c8 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2014).sql @@ -2,13 +2,13 @@ -- SqlServer.2014 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql index fe2335da51a..50f241bde00 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2014).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql index 7b719657a2f..264f023e795 100644 --- a/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2014).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014).sql index 5aae8fa9938..5fcdb459236 100644 --- a/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2014).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -103,13 +103,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014).sql index badf0c047d4..842ae166a69 100644 --- a/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2014).sql @@ -71,13 +71,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014).sql index b5661c92a8e..3a0ac302570 100644 --- a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2014).sql @@ -2,11 +2,11 @@ -- SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014).sql index 9c957becf02..b9747146849 100644 --- a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2014).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014).sql index 9c957becf02..c5bfb341c1b 100644 --- a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2014).sql @@ -2,11 +2,11 @@ -- SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014).sql index 67e54ca15c2..ca20b4215d1 100644 --- a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2014).sql @@ -2,11 +2,11 @@ -- SqlServer.2014 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014).sql index 099ccc00876..30786fae1cd 100644 --- a/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2014).sql @@ -2,11 +2,18 @@ -- SqlServer.2014 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014).sql new file mode 100644 index 00000000000..b10a515e3f7 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2014).sql @@ -0,0 +1,68 @@ +BeforeExecute +-- SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2014 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2014 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2014 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2014 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014).sql index ac10873928a..fb930824b10 100644 --- a/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2014).sql @@ -2,38 +2,28 @@ -- SqlServer.2014 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014).sql new file mode 100644 index 00000000000..dea0213834d --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2014).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014).sql new file mode 100644 index 00000000000..0924c981a16 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2014).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014).sql index d2f94b5b56e..0924c981a16 100644 --- a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2014).sql @@ -2,17 +2,10 @@ -- SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014).sql index 0a1e22b0f24..481231f5e1d 100644 --- a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2014).sql @@ -2,14 +2,10 @@ -- SqlServer.2014 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014).sql new file mode 100644 index 00000000000..f7734129a49 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2014).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014).sql new file mode 100644 index 00000000000..9a4fdadba4f --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2014).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014).sql new file mode 100644 index 00000000000..481231f5e1d --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2014).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014).sql new file mode 100644 index 00000000000..3d5b9dc6c16 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2014).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014).sql new file mode 100644 index 00000000000..d2f94b5b56e --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2014).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014).sql new file mode 100644 index 00000000000..0a1e22b0f24 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2014).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2014 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 03).sql b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 03).sql index 33a898fd45d..2f3318986fa 100644 --- a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 03).sql +++ b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 03).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 04).sql b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 04).sql index 7988561d273..c8c0ecf8c39 100644 --- a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 04).sql +++ b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 04).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 05).sql b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 05).sql index cd5d98a1f1a..77b78930682 100644 --- a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 05).sql +++ b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 05).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 06).sql b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 06).sql index b2188377464..881caa57d31 100644 --- a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 06).sql +++ b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 06).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 07).sql b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 07).sql index 37b1faec4b1..35dbf886018 100644 --- a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 07).sql +++ b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 07).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 12).sql b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 12).sql index d255435123c..635418e698a 100644 --- a/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 12).sql +++ b/SqlServer.2014/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2014,Query 12).sql @@ -34,22 +34,22 @@ BeforeExecute -- SqlServer.2014 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2014 diff --git a/SqlServer.2014/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014).sql b/SqlServer.2014/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014).sql index 39ac5cb6d38..ff14af8abba 100644 --- a/SqlServer.2014/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2014).sql @@ -86,21 +86,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -122,10 +122,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2014/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014).sql b/SqlServer.2014/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014).sql index eacfcf3293e..3e1967a8fc7 100644 --- a/SqlServer.2014/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2014).sql @@ -130,7 +130,7 @@ BeforeExecute -- SqlServer.2014 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -160,7 +160,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -238,7 +238,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014).sql b/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014).sql index 265474b38e4..305b6ada1a0 100644 --- a/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2014).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014).sql b/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014).sql index 02c9b4ea904..df9f58ff0a0 100644 --- a/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2014).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014).sql b/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014).sql index f4d9268e73a..972ea5e480d 100644 --- a/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014).sql +++ b/SqlServer.2014/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2014).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.LinqService,False).sql b/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.LinqService,False).sql index 25e6f7b0941..67adb216f49 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.LinqService,False).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2016 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.LinqService).sql index 30fb66cc1e5..3f2ece48969 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.LinqService).sql index e8c4f9de9e2..2b8ab2352e6 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.LinqService).sql index 63b01d518cb..2f3470c48a2 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.LinqService).sql index af164ea8437..04325443503 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.LinqService).sql index b780f065cd8..b879c8e7e18 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.LinqService).sql index e207e97cffa..56650223d89 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.LinqService).sql index b75fc76a014..2b7d9413e16 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.LinqService).sql index 5ef078a0a10..f393048f7f1 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.LinqService).sql index 25322c4c835..7825b3bc9d9 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.LinqService).sql index 52a2a8409a0..dfe1cc63c8a 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.LinqService).sql index 3f7145863f7..0ec81a433ac 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.LinqService).sql index 19d1cadfe81..92098925eae 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.LinqService).sql index 712e0147e15..29e925c972f 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.LinqService).sql index b03cec8bb74..ecf6f44754e 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.LinqService).sql index f0ab73e7f4e..e45aeeb33d6 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.LinqService).sql index a34d0074ace..2db8eac59a2 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.LinqService).sql index 7c9ceaf7d63..d714d501de5 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.LinqService).sql index 4dc20b24675..5589606389b 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.LinqService).sql index 35a5f628bcb..310868c8a14 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.LinqService).sql index c06e5666133..82f9a7ded82 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,1).sql b/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,1).sql index c5e812fe19c..c0a8760ea29 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,1).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,2).sql b/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,2).sql index fbd35b62a61..76d740bbb27 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,2).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.LinqService).sql index 470dd4ee263..0dc3da9aed4 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,14).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,14).sql index 4138c0b3523..41dae536c5d 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,14).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,15).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,15).sql index ed928cfbb7a..32919068865 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,15).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,14).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,14).sql index 5c4db7f5a14..9fb7c79e72c 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,14).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,15).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,15).sql index bdae2340580..1efee76315e 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,15).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,14).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,14).sql index 67a2b804ff7..ae52ec4cd32 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,14).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,15).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,15).sql index dd10034c5c9..698a42f460e 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,15).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,14).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,14).sql index ff10197db2a..d1d955e8c19 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,14).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,15).sql b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,15).sql index 5b11bf52b9c..c3e9398b214 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,15).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.LinqService).sql index a7c6e0a051a..a9b668e77c9 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.LinqService).sql index a7c6e0a051a..a9b668e77c9 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.LinqService).sql index a7c6e0a051a..a9b668e77c9 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.LinqService).sql index 0c55570311e..584759494c5 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.LinqService).sql index 0c55570311e..584759494c5 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.LinqService).sql index 0c55570311e..584759494c5 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.LinqService).sql index 0e15afa5f95..1efacce908b 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.LinqService).sql index c36358e930b..85d275b69bd 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2016 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.LinqService).sql index 8bfeae70dcf..a33866a266d 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.LinqService).sql index eef945d525a..4fd8001116a 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.LinqService).sql index 0b9e9f29c6b..9e579511433 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql index 1843ea68657..af4d9c3c2d7 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql index 68339e5f15e..cff070dbbab 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql index d8b788f01f6..e26d1b20fec 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql index 8cf8319b3b2..c1b631c0a43 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql index 10513461423..90988c60fdb 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql index eb540ceb97a..10b5e4b93ca 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql index 8a1e0ec5b90..dff026f0abb 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql index a61dca2f554..804bdec7797 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.LinqService).sql index 82b069b9757..569bc349ac2 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.LinqService).sql index ae703c6507e..b30dc74c2fc 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.LinqService).sql index af5316b90c1..6e62a556fdd 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.LinqService).sql index 600b31ef7bb..6d58f1818af 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.LinqService).sql index 600b31ef7bb..08e87378961 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.LinqService).sql index 9e8a7d76ae3..79dc1addfbf 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.LinqService).sql index 8231614f58f..14d143bd78f 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2016 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2016.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..279991677be --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2016 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2016 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..89f695ed901 --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..e502804961c --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.LinqService).sql index 96516aafa8f..e502804961c 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.LinqService).sql index e18c61172a4..c38fa40a105 100644 --- a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..6e177c167ca --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..bdd84152542 --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..c38fa40a105 --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..b0d0bc98a88 --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..96516aafa8f --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.LinqService).sql new file mode 100644 index 00000000000..e18c61172a4 --- /dev/null +++ b/SqlServer.2016.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.LinqService).sql index ddcfe9475eb..eda5b8fa039 100644 --- a/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.LinqService).sql index 54e20e0967c..2a67f9b04ce 100644 --- a/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.LinqService).sql b/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.LinqService).sql index 3bb6e936e2f..e6e7558f7e7 100644 --- a/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.LinqService).sql +++ b/SqlServer.2016.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS.LinqService,False).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS.LinqService,False).sql index 70108725aa9..776ffe9c7b5 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS.LinqService,False).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS.LinqService).sql index 60eda37f47c..1078aeff6dd 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS.LinqService).sql index e3e37af9a56..1db92292920 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS.LinqService).sql index 13d0c9928fd..bd941d075e3 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS.LinqService).sql index 8dbf8274e5d..d6f70fcaf25 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS.LinqService).sql index ff723bc7a25..a059afa7fa0 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS.LinqService).sql index c29ba00360a..932fad1533a 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS.LinqService).sql index e7d43914849..813dbd942c2 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS.LinqService).sql index 6a134b741c1..fcfb8cab9e9 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS.LinqService).sql index 67a811c36fa..6a46cb4c331 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS.LinqService).sql index 609dfdc77fd..01f1f35776e 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS.LinqService).sql index 7fa0bf2f409..0f91adeb714 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS.LinqService).sql index 43f0cac2d7a..0f4dca01f52 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS.LinqService).sql index 9f3cabb7b7b..2a4848e52b0 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS.LinqService).sql index d5786acedaa..78fd7e46be5 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS.LinqService).sql index 99099f49a59..009b3eee405 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS.LinqService).sql index 0c60bf3c0fa..69acf288982 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS.LinqService).sql index 0c9e3dbddf1..8d40c336762 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS.LinqService).sql index bb7b17907e7..92b933f9122 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS.LinqService).sql index 5197250b6e6..d7b46179b28 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS.LinqService).sql index d720d5b9409..3cac93c22be 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,1).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,1).sql index ea3268a4c00..e0cbb634354 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,1).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,2).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,2).sql index 36befd111f2..23f864a1a4e 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,2).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS.LinqService).sql index 59b1c0c085f..d9f4a482766 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,14).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,14).sql index 8845540d4e6..4b284bb1e98 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,14).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,15).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,15).sql index 265d3e845f5..e681ae7b55e 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,15).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,14).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,14).sql index 5736a3c9b24..410d99d2dc7 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,14).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,15).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,15).sql index 21b69319402..3019254710d 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,15).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,14).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,14).sql index 1daa60a5f66..e9ec369c450 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,14).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,15).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,15).sql index 3892d7cfd5a..e610f3fa18c 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,15).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,14).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,14).sql index 56aa678bc71..90ab0639644 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,14).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,15).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,15).sql index 6b3314ecac3..81f87922c23 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,15).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS.LinqService).sql index 5dbd5c3d5b5..a2f80bd1bb1 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS.LinqService).sql index 5dbd5c3d5b5..a2f80bd1bb1 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS.LinqService).sql index 5dbd5c3d5b5..a2f80bd1bb1 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS.LinqService).sql index e9d6e48bdd1..3d946440f11 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS.LinqService).sql index e9d6e48bdd1..3d946440f11 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS.LinqService).sql index e9d6e48bdd1..3d946440f11 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS.LinqService).sql index 2ad93ea2088..1c02c084786 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS.LinqService).sql index f4d18316c39..df849d8d95b 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS.LinqService).sql index cf927638f12..45e6c09aa08 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS.LinqService).sql index a4c8942f01c..c7e6575608c 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS.LinqService).sql index 4647431a80a..26419008066 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql index aaa91a2c614..18b83f8d1a4 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql index 240b47e498c..17e6f74099d 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql index 5931b604fbf..37933c482bd 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql index 49c42c104a2..8fac1f31b37 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql index 8a597d7fb90..391ec9b56ab 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql index 90e877b0a38..7ef18d6a02b 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql index 0af7061f294..c338c2d9d74 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql index c133c2f5b58..20573fad026 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS.LinqService).sql index d855415c198..effedaedda6 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS.LinqService).sql index 5da2ee4e224..95dcaa53f17 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS.LinqService).sql index 9a06b81320a..7a0b313dabf 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS.LinqService).sql index 6f0ca6220d7..a4c953694b6 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS.LinqService).sql index 6f0ca6220d7..9abe3ea3a01 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS.LinqService).sql index f8709c86b2a..592710d4b0b 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS.LinqService).sql index 21e0ca93efc..97bc34fb8c3 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..da0f9d7be67 --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..c4bf05af77c --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..2dbeb18d50b --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS.LinqService).sql index bc5c2bd1914..2dbeb18d50b 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS.LinqService).sql index 9eb07b2f6af..f236d7edb2e 100644 --- a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..73e87f77c33 --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..725f96d88a5 --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..f236d7edb2e --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..5265b1745e1 --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..bc5c2bd1914 --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.MS.LinqService).sql new file mode 100644 index 00000000000..9eb07b2f6af --- /dev/null +++ b/SqlServer.2016.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS.LinqService).sql index 58fb2a1836e..ac02125d7e4 100644 --- a/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS.LinqService).sql index c2c6dc53bda..af7e528b721 100644 --- a/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS.LinqService).sql b/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS.LinqService).sql index d2457f9a8fd..461939ff417 100644 --- a/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS.LinqService).sql +++ b/SqlServer.2016.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016.MS).sql index 230773798ac..1225ed09ed2 100644 --- a/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016.MS).sql index 230773798ac..1225ed09ed2 100644 --- a/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016.MS).sql index 512b79b439b..03de2b05b37 100644 --- a/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS,False).sql b/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS,False).sql index a7cf0e507d9..f4c39826e99 100644 --- a/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS,False).sql +++ b/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016.MS,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS).sql index 60eda37f47c..1078aeff6dd 100644 --- a/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016.MS).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS).sql index 92dc8176209..9579ab0789a 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS).sql index e4c84c58130..6e154c86dc9 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS).sql index 008a341942a..131aae6b496 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS).sql index b7225bf9ad8..341ba6f3698 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS).sql index d4788a6307f..42da2167c7c 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS).sql index 3e77b21f5ca..30f089b4327 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS).sql index 4b116801f65..d2b3d043bd0 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS).sql index 81c49d6d447..48ed3634d55 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS).sql index 70c4be10c75..11ba4ccf5d0 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS).sql index 15e1ca799b5..45b919d500f 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS).sql index f3e8313f321..b04e902b245 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS).sql index c4f5ffddcfd..766d8321a30 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS).sql index 26670f9cfb0..31153bc2c83 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS).sql index 2a9c774b6c5..633b37f307a 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS).sql index a0ea6ad2271..68d6d295beb 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS).sql index b35c4609cbd..1d68bf504da 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS).sql index d22d67cc149..5184de1da05 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS).sql index 60a58971be1..afb834cc5ef 100644 --- a/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS).sql index d720d5b9409..3cac93c22be 100644 --- a/SqlServer.2016.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,1).sql b/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,1).sql index ea3268a4c00..e0cbb634354 100644 --- a/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,1).sql +++ b/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,2).sql b/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,2).sql index 36befd111f2..23f864a1a4e 100644 --- a/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,2).sql +++ b/SqlServer.2016.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS).sql index 59b1c0c085f..d9f4a482766 100644 --- a/SqlServer.2016.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016.MS).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,14).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,14).sql index a420ac6c333..0069beb9bdd 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,14).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,15).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,15).sql index 46da333e4b3..ba20eb3677a 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,15).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,14).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,14).sql index c49a55327c6..8c17a7ea3c7 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,14).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,15).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,15).sql index dbc163469e2..655062d6d81 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,15).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,14).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,14).sql index 652b1b9d5c2..4007fac88e3 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,14).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,15).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,15).sql index 6116064dc8e..f47f6cbbdc7 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,15).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,14).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,14).sql index 4ad5f05d9e8..6cb4cdd49f1 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,14).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,15).sql b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,15).sql index b9d45479be1..12dd52ad574 100644 --- a/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,15).sql +++ b/SqlServer.2016.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS).sql index 5dbd5c3d5b5..a2f80bd1bb1 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS).sql index 5dbd5c3d5b5..a2f80bd1bb1 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS).sql index 5dbd5c3d5b5..a2f80bd1bb1 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS).sql index e9d6e48bdd1..3d946440f11 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS).sql index e9d6e48bdd1..3d946440f11 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS).sql index e9d6e48bdd1..3d946440f11 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS).sql index 2ad93ea2088..1c02c084786 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016.MS).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS).sql index 5d00473e5d0..de0f8f028a4 100644 --- a/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016.MS).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016.MS).sql index 268463bb453..aba129933b0 100644 --- a/SqlServer.2016.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS).sql index cf927638f12..45e6c09aa08 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS).sql index a4c8942f01c..c7e6575608c 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS).sql index 4647431a80a..26419008066 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql index aaa91a2c614..18b83f8d1a4 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql index 240b47e498c..17e6f74099d 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql index 5931b604fbf..37933c482bd 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql index 49c42c104a2..8fac1f31b37 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql index 8a597d7fb90..391ec9b56ab 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql index 90e877b0a38..7ef18d6a02b 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql index 0af7061f294..c338c2d9d74 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql index c133c2f5b58..20573fad026 100644 --- a/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS).sql index 7150f91c0f2..a8926a43848 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS).sql index 2e1434feddb..94b544c92f0 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS).sql index 9a06b81320a..7a0b313dabf 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS).sql index 6f0ca6220d7..a4c953694b6 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS).sql index 6f0ca6220d7..9abe3ea3a01 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS).sql index f8709c86b2a..592710d4b0b 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS).sql index 21e0ca93efc..97bc34fb8c3 100644 --- a/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..ae54b56917d --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016.MS).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016.MS).sql index adaf793b218..f0662c0280c 100644 --- a/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..c4bf05af77c --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..2dbeb18d50b --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS).sql index bc5c2bd1914..2dbeb18d50b 100644 --- a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS).sql index 9eb07b2f6af..f236d7edb2e 100644 --- a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2016.MS SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..73e87f77c33 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..725f96d88a5 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..f236d7edb2e --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..5265b1745e1 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..bc5c2bd1914 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.MS).sql new file mode 100644 index 00000000000..9eb07b2f6af --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 03).sql b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 03).sql index c25acc7cf5e..b85196e0879 100644 --- a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 03).sql +++ b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 04).sql b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 04).sql index 31350a7c240..81c9517798a 100644 --- a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 04).sql +++ b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 05).sql b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 05).sql index cb961962d52..9351cc51f51 100644 --- a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 05).sql +++ b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 06).sql b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 06).sql index 35d1acf3d1e..0789e970c4d 100644 --- a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 06).sql +++ b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 07).sql b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 07).sql index c8f0fb495af..dd697974c6f 100644 --- a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 07).sql +++ b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 12).sql b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 12).sql index 16a02a8d14c..689eebcd18a 100644 --- a/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 12).sql +++ b/SqlServer.2016.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016.MS SqlServer.2016 diff --git a/SqlServer.2016.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016.MS).sql index 2e055e91acd..4d2b748779c 100644 --- a/SqlServer.2016.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016.MS).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2016.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016.MS).sql index aa5a5096a7f..76d4219ce5c 100644 --- a/SqlServer.2016.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016.MS).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2016.MS SqlServer.2016 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS).sql index 58fb2a1836e..ac02125d7e4 100644 --- a/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS).sql index c2c6dc53bda..af7e528b721 100644 --- a/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS).sql index d2457f9a8fd..461939ff417 100644 --- a/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS).sql +++ b/SqlServer.2016.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016).sql index 2d937891fb4..5a4b9734931 100644 --- a/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2016).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016).sql index 2d937891fb4..5a4b9734931 100644 --- a/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2016).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016).sql index ce99d626362..4ff68b6b4b3 100644 --- a/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2016).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016,False).sql b/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016,False).sql index d401c7ebba4..8113d0cea55 100644 --- a/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016,False).sql +++ b/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2016,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2016 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016).sql index 30fb66cc1e5..3f2ece48969 100644 --- a/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2016).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016).sql index 70e99ee4cab..e1e04bb08f7 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016).sql index cb298b93d3d..0cebd86869d 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016).sql index 16e20256e8f..877db766983 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016).sql index 2eb03389fa6..6c9cfc1efdf 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016).sql index 2c17962dcb9..7112fc9da15 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016).sql index e69216f1d0e..9a3d6d7c5c4 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016).sql index cc59c474719..8d45332ecd4 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016).sql index ba977fe17ce..00a7f5a89e5 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016).sql index e72951feaf2..e24eab0250d 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016).sql index 00110c2d80c..8c80da82864 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016).sql index 0711755674a..b700b6f2448 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016).sql index a2d92a8bf4a..e684b287130 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016).sql index f6cc0babd6a..12e834d00c6 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016).sql index 842ec15c656..72956e2c37d 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016).sql index c499e61e68b..b673ecdc4f6 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016).sql index b4799903002..417ae01b2d6 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016).sql index 577c24dec80..3250f50b490 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016).sql index 9136903948a..663f7391fc9 100644 --- a/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2016).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016).sql index c06e5666133..82f9a7ded82 100644 --- a/SqlServer.2016/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2016).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,1).sql b/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,1).sql index c5e812fe19c..c0a8760ea29 100644 --- a/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,1).sql +++ b/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,2).sql b/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,2).sql index fbd35b62a61..76d740bbb27 100644 --- a/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,2).sql +++ b/SqlServer.2016/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2016,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2016/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016).sql index 470dd4ee263..0dc3da9aed4 100644 --- a/SqlServer.2016/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2016).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,14).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,14).sql index 81570fdbde7..5f793127514 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,14).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,15).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,15).sql index 2021f2b734b..b9b7e134171 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,15).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2016,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,14).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,14).sql index bff15eee99a..a0a999d4970 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,14).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,15).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,15).sql index b25223cf8f7..53c04808eb7 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,15).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2016,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,14).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,14).sql index c556d0966a2..f13d49bb629 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,14).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,15).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,15).sql index 9448b4b7e23..14e2b8f2d75 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,15).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2016,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,14).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,14).sql index 3528c7ff822..0f6a791666e 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,14).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,15).sql b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,15).sql index d1b24d43847..bce30673e11 100644 --- a/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,15).sql +++ b/SqlServer.2016/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2016,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016).sql index a7c6e0a051a..a9b668e77c9 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2016).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016).sql index a7c6e0a051a..a9b668e77c9 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2016).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016).sql index a7c6e0a051a..a9b668e77c9 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2016).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016).sql index 0c55570311e..584759494c5 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2016).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016).sql index 0c55570311e..584759494c5 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2016).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016).sql index 0c55570311e..584759494c5 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2016).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016).sql index 0e15afa5f95..1efacce908b 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2016).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016).sql index cb36e7837da..c0013917cb7 100644 --- a/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2016).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016).sql index d9c90bf4b0a..91cea9fe12f 100644 --- a/SqlServer.2016/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2016).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016).sql index 8bfeae70dcf..a33866a266d 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2016).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016).sql index eef945d525a..4fd8001116a 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2016).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016).sql index 0b9e9f29c6b..9e579511433 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2016).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql index 1843ea68657..af4d9c3c2d7 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql index 68339e5f15e..cff070dbbab 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql @@ -2,13 +2,13 @@ -- SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql index d8b788f01f6..e26d1b20fec 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql index 8cf8319b3b2..c1b631c0a43 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql index 10513461423..90988c60fdb 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2016).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql index eb540ceb97a..10b5e4b93ca 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2016).sql @@ -2,13 +2,13 @@ -- SqlServer.2016 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql index 8a1e0ec5b90..dff026f0abb 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2016).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql index a61dca2f554..804bdec7797 100644 --- a/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2016).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016).sql index a9867315326..392f64e217e 100644 --- a/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2016).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016).sql index 349429b64b7..7032b7a1d99 100644 --- a/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2016).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016).sql index af5316b90c1..6e62a556fdd 100644 --- a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2016).sql @@ -2,11 +2,11 @@ -- SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016).sql index 600b31ef7bb..6d58f1818af 100644 --- a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2016).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016).sql index 600b31ef7bb..08e87378961 100644 --- a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2016).sql @@ -2,11 +2,11 @@ -- SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016).sql index 9e8a7d76ae3..79dc1addfbf 100644 --- a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2016).sql @@ -2,11 +2,11 @@ -- SqlServer.2016 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016).sql index 8231614f58f..14d143bd78f 100644 --- a/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2016).sql @@ -2,11 +2,18 @@ -- SqlServer.2016 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016).sql new file mode 100644 index 00000000000..97a1668790c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2016).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2016 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2016 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2016 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2016 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2016 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016).sql index 4294323ddfa..7c78da6c2bc 100644 --- a/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2016).sql @@ -2,38 +2,28 @@ -- SqlServer.2016 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016).sql new file mode 100644 index 00000000000..89f695ed901 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2016).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016).sql new file mode 100644 index 00000000000..e502804961c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2016).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016).sql index 96516aafa8f..e502804961c 100644 --- a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2016).sql @@ -2,17 +2,10 @@ -- SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016).sql index e18c61172a4..c38fa40a105 100644 --- a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2016).sql @@ -2,14 +2,10 @@ -- SqlServer.2016 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016).sql new file mode 100644 index 00000000000..6e177c167ca --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2016).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016).sql new file mode 100644 index 00000000000..bdd84152542 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2016).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016).sql new file mode 100644 index 00000000000..c38fa40a105 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2016).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016).sql new file mode 100644 index 00000000000..b0d0bc98a88 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2016).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016).sql new file mode 100644 index 00000000000..96516aafa8f --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2016).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016).sql new file mode 100644 index 00000000000..e18c61172a4 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2016).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2016 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 03).sql b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 03).sql index 0158a0901dc..c7d27b8d89b 100644 --- a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 03).sql +++ b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 04).sql b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 04).sql index 71c6e689f1a..463fd0ce721 100644 --- a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 04).sql +++ b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 05).sql b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 05).sql index 6855926a5d3..33c71b74359 100644 --- a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 05).sql +++ b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 06).sql b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 06).sql index 5fe29b63544..d13a247ae33 100644 --- a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 06).sql +++ b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 07).sql b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 07).sql index 7cfec690283..345c4f96250 100644 --- a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 07).sql +++ b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 12).sql b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 12).sql index 32654a9f77d..d700cac527f 100644 --- a/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 12).sql +++ b/SqlServer.2016/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2016,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2016 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2016 diff --git a/SqlServer.2016/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016).sql b/SqlServer.2016/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016).sql index e7e4664c398..86e25b27f07 100644 --- a/SqlServer.2016/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2016).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2016/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016).sql b/SqlServer.2016/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016).sql index 841867f98f0..f5f9b03e065 100644 --- a/SqlServer.2016/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2016).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2016 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016).sql b/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016).sql index ddcfe9475eb..eda5b8fa039 100644 --- a/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2016).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016).sql b/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016).sql index 54e20e0967c..2a67f9b04ce 100644 --- a/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2016).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016).sql b/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016).sql index 3bb6e936e2f..e6e7558f7e7 100644 --- a/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016).sql +++ b/SqlServer.2016/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2016).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.LinqService,False).sql b/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.LinqService,False).sql index bec42d6094d..7220271b290 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.LinqService,False).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2017 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.LinqService).sql index a4ee26d3e74..71af9c46f72 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.LinqService).sql index c53b5f36f6e..1a231ee88b8 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.LinqService).sql index a2456672504..40953a7070a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.LinqService).sql index 26a7fe20936..e5af19f933c 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.LinqService).sql index 48f8bffe4b8..0330da6616e 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.LinqService).sql index 72a819f583b..3a9155765dc 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.LinqService).sql index 7bbb78d03e9..63acc1de1b0 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.LinqService).sql index c7d9ac9b6a8..0d6714166e4 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.LinqService).sql index 4a0acc70ed1..777bee3a239 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.LinqService).sql index a018678177c..a02ab2a560a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.LinqService).sql index 607720bcc1c..13cc6785640 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.LinqService).sql index 0e2ce692199..0a9709d4da9 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.LinqService).sql index 7a15ca2ea41..33ab67d5430 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.LinqService).sql index 75545bb9967..d6dda49c8b1 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.LinqService).sql index 4b85c205ee0..093cfd6ac42 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.LinqService).sql index a02b938188d..41afa6ed72a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.LinqService).sql index f5ba79344bc..7b5914e16b1 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.LinqService).sql index 3ec351e63da..e3ffe731234 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.LinqService).sql index 04b91fff301..2985105b277 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.LinqService).sql index fa6d9863799..7d108ef887c 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,1).sql b/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,1).sql index fdd13f14570..090a2c1103a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,1).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,2).sql b/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,2).sql index d71c7b41586..9b19daf8a8b 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,2).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.LinqService).sql index 09a70cf68f9..786a2828096 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,14).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,14).sql index 34d8629e0c9..ec6df7a7e0a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,14).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,15).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,15).sql index 7889e47d256..49452f403f4 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,15).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,14).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,14).sql index 22ec17a6a82..e05c8994495 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,14).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,15).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,15).sql index 51b1431b0d3..225c66e20b0 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,15).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,14).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,14).sql index 7e47279fd17..0c81e722744 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,14).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,15).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,15).sql index 0284c50ba4b..d80bf85a58c 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,15).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,14).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,14).sql index 63d39593cd6..8feedddeada 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,14).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,15).sql b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,15).sql index 0f319a8bf57..afc3d1522ad 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,15).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.LinqService).sql index d8eeb593d8f..df4d91f3e31 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.LinqService).sql index d8eeb593d8f..df4d91f3e31 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.LinqService).sql index d8eeb593d8f..df4d91f3e31 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.LinqService).sql index 8fefc32b2e6..e0e3e2d96d4 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.LinqService).sql index 8fefc32b2e6..e0e3e2d96d4 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.LinqService).sql index 8fefc32b2e6..e0e3e2d96d4 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.LinqService).sql index ad4b473e07b..652ace41967 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.LinqService).sql index dd34bbc0cd6..c314844f71a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2017 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.LinqService).sql index 85872076b80..21c30ae5c98 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.LinqService).sql index cad6feae43f..9f6336d581b 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.LinqService).sql index 716051cfe0e..02c0ed10c63 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql index 42ad984a815..aacb0a758fc 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql index 32fa85440e6..58a1a6f6de6 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql index c1f6583ca82..9593a0f5401 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql index 5cfa069d46a..1b70b9f9c95 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql index 8ee77bb042e..8cf07853c0e 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql index b126bcaee40..7f12773ef41 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql index c972c9d8f61..e21dbe49e7d 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql index e893d48fd3c..4f5d2dc7ebe 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.LinqService).sql index 7bbc4e94dec..19f9bfcd386 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.LinqService).sql index fb027a77322..07c54ed6753 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.LinqService).sql index dbe02d0dc0f..4a014ff2d1a 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.LinqService).sql index ac2010128fd..40bc7cf5ff4 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.LinqService).sql index ac2010128fd..0eb11acb0dc 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.LinqService).sql index e61d2fe9d05..fe0b5ec69ef 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.LinqService).sql index 60b435556f4..37b4857ab3d 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2017 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2017.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..d3724630514 --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2017 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2017 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..30355a765af --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..85401e6b774 --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.LinqService).sql index ff0f06eaffa..85401e6b774 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.LinqService).sql index aa61cd436df..be1517c501b 100644 --- a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..4d87b62f964 --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..390f6447d60 --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..be1517c501b --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..57bef4da8d5 --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..ff0f06eaffa --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.LinqService).sql new file mode 100644 index 00000000000..aa61cd436df --- /dev/null +++ b/SqlServer.2017.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.LinqService).sql index a76b4858b35..a3451d44e09 100644 --- a/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.LinqService).sql index b3e47b7e0ca..07cbbde5241 100644 --- a/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.LinqService).sql b/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.LinqService).sql index 2102324a0ec..e90c18545d4 100644 --- a/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.LinqService).sql +++ b/SqlServer.2017.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS.LinqService,False).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS.LinqService,False).sql index d3a61d1d46f..a874e06049d 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS.LinqService,False).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS.LinqService).sql index 2fc0bc2edb0..0cf097f0858 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS.LinqService).sql index 680237cd880..a10d43070c1 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS.LinqService).sql index b1f12185aab..68aa8979705 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS.LinqService).sql index 2464e538041..0cbd583c97f 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS.LinqService).sql index dac64ff1500..20bc1fdcee5 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS.LinqService).sql index 85aac9fbc1d..26b1f904f10 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS.LinqService).sql index 90ecb5b27e6..ffbcbea34b3 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS.LinqService).sql index 4821e3a78b8..a345493becf 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS.LinqService).sql index a1e379d273e..320d893a1f1 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS.LinqService).sql index 5bce53cc916..7bd83a6c0b9 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS.LinqService).sql index 27ba31ff513..261b61b2f3c 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS.LinqService).sql index 92107761a45..5769109045e 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS.LinqService).sql index e874c7bd57a..59c8ed3373a 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS.LinqService).sql index 96b9204afc2..0bc0d0b604c 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS.LinqService).sql index 32e18028198..f9d3ca40634 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS.LinqService).sql index 9cf749ab473..4ebba401d27 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS.LinqService).sql index dfe8c28c310..73828670ee6 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS.LinqService).sql index d82c1626e3a..73a9edabe35 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS.LinqService).sql index 5fecf3f7f2d..8d927a7e693 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS.LinqService).sql index 8a51519392a..e8295013c2d 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,1).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,1).sql index 3a6e0bc1758..f2dea4d6d8a 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,1).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,2).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,2).sql index de80f4a9133..3e7674b62b5 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,2).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS.LinqService).sql index ffdec9f828d..e7f6da62a74 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,14).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,14).sql index 39c89081a10..7511b6b669e 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,14).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,15).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,15).sql index e69f41c39a8..dca3c95a49b 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,15).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,14).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,14).sql index 222b7a0922c..a8db24692ab 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,14).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,15).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,15).sql index 2fc3f7af0f3..9a04502f790 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,15).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,14).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,14).sql index d2770058f25..dfe90741377 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,14).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,15).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,15).sql index c054e806ebf..d48480c6e2b 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,15).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,14).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,14).sql index 042ee01e988..c00b1b4f6f9 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,14).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,15).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,15).sql index 1966b20ad97..581255e0448 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,15).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS.LinqService).sql index 72e7a6f55b5..cfd0afe0e95 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS.LinqService).sql index 72e7a6f55b5..cfd0afe0e95 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS.LinqService).sql index 72e7a6f55b5..cfd0afe0e95 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS.LinqService).sql index 442fe6b4c8e..95e343bfd7b 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS.LinqService).sql index 442fe6b4c8e..95e343bfd7b 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS.LinqService).sql index 442fe6b4c8e..95e343bfd7b 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS.LinqService).sql index be626896866..4a01971fa37 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS.LinqService).sql index d76d968a62f..7859d1f614d 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS.LinqService).sql index 8aa6c171d81..0a3a90cfacb 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS.LinqService).sql index 98e7351ef27..349e1beddf0 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS.LinqService).sql index 0ca0b81d635..3b7fda3e5f4 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql index a6d1577388c..6e2a5992225 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql index bed16ddd3a5..90365237abf 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql index e2bf8ab24e7..047e8ade47c 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql index 2523bb588a0..f2172931f0f 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql index 5e4562befe2..0f71275c860 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql index d74f342fa40..7da30918660 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql index b9ca5f8ca89..e64b4655bf8 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql index 49be5fbbbed..8f903a7d86c 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS.LinqService).sql index 4e5963689f1..f13434ffb28 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS.LinqService).sql index fab776cdd37..76e93a0f482 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS.LinqService).sql index e32d9765410..0d4b3e9c63c 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS.LinqService).sql index b3765c517de..6070bf98570 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS.LinqService).sql index b3765c517de..7e9e253c973 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS.LinqService).sql index 0c88bfa46c3..f9f02db7146 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS.LinqService).sql index f504e28932b..da9e2b816ac 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..40eb26632e1 --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..7e747910a9e --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..74263bb695f --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS.LinqService).sql index bc913dcb0c3..74263bb695f 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS.LinqService).sql index b839dbf85f9..182dcf1958d 100644 --- a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..7dc2cf31169 --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..3eee731d36a --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..182dcf1958d --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..f0aa26814eb --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..bc913dcb0c3 --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.MS.LinqService).sql new file mode 100644 index 00000000000..b839dbf85f9 --- /dev/null +++ b/SqlServer.2017.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS.LinqService).sql index 88a0dd8de83..a25a4ff73fa 100644 --- a/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS.LinqService).sql index 42999914e5e..f0ea367f2a0 100644 --- a/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS.LinqService).sql b/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS.LinqService).sql index 7fd459fbff1..4508be942c9 100644 --- a/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS.LinqService).sql +++ b/SqlServer.2017.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017.MS).sql index da4fd0ce66b..dfefc34c75f 100644 --- a/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017.MS).sql index da4fd0ce66b..dfefc34c75f 100644 --- a/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017.MS).sql index e3a570f4eab..3efd99a33d2 100644 --- a/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS,False).sql b/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS,False).sql index 3dc4088bf1b..686ba3d024d 100644 --- a/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS,False).sql +++ b/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017.MS,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS).sql index 2fc0bc2edb0..0cf097f0858 100644 --- a/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017.MS).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS).sql index 7e77bbb7c87..84a5fe187b0 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS).sql index 6fce4e42072..cde976d1e64 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS).sql index 6018f4608bc..a8cda227666 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS).sql index a9a34f6b51c..9b3efd24bbc 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS).sql index ecfd3bcdeb1..627b2dc0b4a 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS).sql index afb58b86676..e89c53a808f 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS).sql index 40916e619ce..0bdd2070584 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS).sql index 56bad9da4c7..f707dd8ad5b 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS).sql index aaf1d3eca2c..8d3f6fa6242 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS).sql index adf702b0338..afe31c3d187 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS).sql index f61219e4bc8..6b9a05ad722 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS).sql index 0b966ce35c0..b008c892ad8 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS).sql index 600f8940b1e..017b6037c91 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS).sql index f97c4116f74..8281f40163e 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS).sql index c200ed607e5..de58c2d7b78 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS).sql index e82a01ab670..aa27668ebc8 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS).sql index 42768d5962e..b253fd2c2f3 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS).sql index e2f306e894f..c0632c98fe3 100644 --- a/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS).sql index 8a51519392a..e8295013c2d 100644 --- a/SqlServer.2017.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,1).sql b/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,1).sql index 3a6e0bc1758..f2dea4d6d8a 100644 --- a/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,1).sql +++ b/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,2).sql b/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,2).sql index de80f4a9133..3e7674b62b5 100644 --- a/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,2).sql +++ b/SqlServer.2017.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS).sql index ffdec9f828d..e7f6da62a74 100644 --- a/SqlServer.2017.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017.MS).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,14).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,14).sql index 60e85f8b89b..d679a52ae48 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,14).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,15).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,15).sql index 15acdfcfd61..1df708a038f 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,15).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,14).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,14).sql index 2bfcc78e1f0..f2c3b737d2a 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,14).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,15).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,15).sql index 44ea8727303..a6752a60dcd 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,15).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,14).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,14).sql index 1cf8eb38b43..fa772333d67 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,14).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,15).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,15).sql index cb0ed3d3270..8b5abf12204 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,15).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,14).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,14).sql index 0df0e76a094..b728ee78cdb 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,14).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,15).sql b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,15).sql index a46d5bb5a54..fafd3c25c4f 100644 --- a/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,15).sql +++ b/SqlServer.2017.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS).sql index 72e7a6f55b5..cfd0afe0e95 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS).sql index 72e7a6f55b5..cfd0afe0e95 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS).sql index 72e7a6f55b5..cfd0afe0e95 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS).sql index 442fe6b4c8e..95e343bfd7b 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS).sql index 442fe6b4c8e..95e343bfd7b 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS).sql index 442fe6b4c8e..95e343bfd7b 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS).sql index be626896866..4a01971fa37 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017.MS).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS).sql index fd3d9a55f3f..8c9fd18a326 100644 --- a/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017.MS).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017.MS).sql index a609f522ebe..e47a727ee6b 100644 --- a/SqlServer.2017.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS).sql index 8aa6c171d81..0a3a90cfacb 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS).sql index 98e7351ef27..349e1beddf0 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS).sql index 0ca0b81d635..3b7fda3e5f4 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql index a6d1577388c..6e2a5992225 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql index bed16ddd3a5..90365237abf 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql index e2bf8ab24e7..047e8ade47c 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql index 2523bb588a0..f2172931f0f 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql index 5e4562befe2..0f71275c860 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql index d74f342fa40..7da30918660 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql index b9ca5f8ca89..e64b4655bf8 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql index 49be5fbbbed..8f903a7d86c 100644 --- a/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS).sql index d06a231ba30..55354af2291 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS).sql index 0cf7210a01a..2a57404ab58 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS).sql index e32d9765410..0d4b3e9c63c 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS).sql index b3765c517de..6070bf98570 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS).sql index b3765c517de..7e9e253c973 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS).sql index 0c88bfa46c3..f9f02db7146 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS).sql index f504e28932b..da9e2b816ac 100644 --- a/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..e8c6eca545c --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017.MS).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017.MS).sql index d00d7f33eaf..b2a4bbc4f72 100644 --- a/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..7e747910a9e --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..74263bb695f --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS).sql index bc913dcb0c3..74263bb695f 100644 --- a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS).sql index b839dbf85f9..182dcf1958d 100644 --- a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2017.MS SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..7dc2cf31169 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..3eee731d36a --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..182dcf1958d --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..f0aa26814eb --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..bc913dcb0c3 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.MS).sql new file mode 100644 index 00000000000..b839dbf85f9 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 03).sql b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 03).sql index 51e9fd56505..65024596409 100644 --- a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 03).sql +++ b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 04).sql b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 04).sql index c01fc05ce1a..308c374a1e1 100644 --- a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 04).sql +++ b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 05).sql b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 05).sql index e846d1c4de0..2fe89d89230 100644 --- a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 05).sql +++ b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 06).sql b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 06).sql index d7b07a180eb..d0d2852dd22 100644 --- a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 06).sql +++ b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 07).sql b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 07).sql index 0516507e5fa..835a11350c9 100644 --- a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 07).sql +++ b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 12).sql b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 12).sql index 98db9950450..6c3e6699f79 100644 --- a/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 12).sql +++ b/SqlServer.2017.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017.MS SqlServer.2017 diff --git a/SqlServer.2017.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017.MS).sql index b6b40c7495d..8a01f6e92db 100644 --- a/SqlServer.2017.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017.MS).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2017.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017.MS).sql index 89e8a48ba43..901067d22ce 100644 --- a/SqlServer.2017.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017.MS).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2017.MS SqlServer.2017 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS).sql index 88a0dd8de83..a25a4ff73fa 100644 --- a/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS).sql index 42999914e5e..f0ea367f2a0 100644 --- a/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS).sql index 7fd459fbff1..4508be942c9 100644 --- a/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS).sql +++ b/SqlServer.2017.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017).sql index 6beb1cab053..414e932dc46 100644 --- a/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2017).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017).sql index 6beb1cab053..414e932dc46 100644 --- a/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2017).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017).sql index 447985dcfd1..a5c596a2b54 100644 --- a/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2017).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017,False).sql b/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017,False).sql index 616541c2bae..1e9dacbbf6f 100644 --- a/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017,False).sql +++ b/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2017,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2017 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017).sql index a4ee26d3e74..71af9c46f72 100644 --- a/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2017).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017).sql index 5067eef8361..904122395ac 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017).sql index f5f161d7e31..b273e4ec799 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017).sql index 8f36c0241a2..d663e89b556 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017).sql index f7497330bdb..c73313ab516 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017).sql index 18ce9b3d329..cd35a3e6f74 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017).sql index 38b84f4bad7..abf3b8fd452 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017).sql index 83d17562a6d..3715bb59763 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017).sql index 4238274ea2c..b7c52e80b6a 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017).sql index b15c387e051..1813afdd270 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017).sql index bdd3e6a4533..c994529d049 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017).sql index 2bbd359019f..0f20c1926ca 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017).sql index e0931d5d1bf..dceeecda169 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017).sql index 9769358b8e9..cbf7e5b17df 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017).sql index 514499eaf72..8fc405968f5 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017).sql index 24f54d63737..26b3b9686b4 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017).sql index be7e9268757..35947e1445b 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017).sql index 113d117e443..2430dc65320 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017).sql index ca5c6c6e816..0767bf06080 100644 --- a/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2017).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017).sql index fa6d9863799..7d108ef887c 100644 --- a/SqlServer.2017/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2017).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,1).sql b/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,1).sql index fdd13f14570..090a2c1103a 100644 --- a/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,1).sql +++ b/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,2).sql b/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,2).sql index d71c7b41586..9b19daf8a8b 100644 --- a/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,2).sql +++ b/SqlServer.2017/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2017,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2017/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017).sql index 09a70cf68f9..786a2828096 100644 --- a/SqlServer.2017/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2017).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,14).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,14).sql index 6aad13a6584..0402edb5074 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,14).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,15).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,15).sql index 868195fc305..b8a19ac05e5 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,15).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2017,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,14).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,14).sql index b1a2fa18cbf..2190963d9a5 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,14).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,15).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,15).sql index 9e1cb4a7024..8584201887e 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,15).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2017,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,14).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,14).sql index 9655e8ce642..ae25f49a255 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,14).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,15).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,15).sql index 1fe1f71f224..ac200192cb7 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,15).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2017,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,14).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,14).sql index eefc3cb46eb..fad87ca9875 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,14).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,15).sql b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,15).sql index 63b2a9026e2..3afc1545e73 100644 --- a/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,15).sql +++ b/SqlServer.2017/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2017,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017).sql index d8eeb593d8f..df4d91f3e31 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2017).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017).sql index d8eeb593d8f..df4d91f3e31 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2017).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017).sql index d8eeb593d8f..df4d91f3e31 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2017).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017).sql index 8fefc32b2e6..e0e3e2d96d4 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2017).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017).sql index 8fefc32b2e6..e0e3e2d96d4 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2017).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017).sql index 8fefc32b2e6..e0e3e2d96d4 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2017).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017).sql index ad4b473e07b..652ace41967 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2017).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017).sql index 02857f91571..8e1a3815cf2 100644 --- a/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2017).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017).sql index 1a1c99ecea8..7103d00d64d 100644 --- a/SqlServer.2017/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2017).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017).sql index 85872076b80..21c30ae5c98 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2017).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017).sql index cad6feae43f..9f6336d581b 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2017).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017).sql index 716051cfe0e..02c0ed10c63 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2017).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql index 42ad984a815..aacb0a758fc 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql index 32fa85440e6..58a1a6f6de6 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql @@ -2,13 +2,13 @@ -- SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql index c1f6583ca82..9593a0f5401 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql index 5cfa069d46a..1b70b9f9c95 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql index 8ee77bb042e..8cf07853c0e 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2017).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql index b126bcaee40..7f12773ef41 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2017).sql @@ -2,13 +2,13 @@ -- SqlServer.2017 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql index c972c9d8f61..e21dbe49e7d 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2017).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql index e893d48fd3c..4f5d2dc7ebe 100644 --- a/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2017).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017).sql index 0a87cc1f514..00a6d620801 100644 --- a/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2017).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017).sql index 729477ffb3a..97ceecd8461 100644 --- a/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2017).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017).sql index dbe02d0dc0f..4a014ff2d1a 100644 --- a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2017).sql @@ -2,11 +2,11 @@ -- SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017).sql index ac2010128fd..40bc7cf5ff4 100644 --- a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2017).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017).sql index ac2010128fd..0eb11acb0dc 100644 --- a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2017).sql @@ -2,11 +2,11 @@ -- SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017).sql index e61d2fe9d05..fe0b5ec69ef 100644 --- a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2017).sql @@ -2,11 +2,11 @@ -- SqlServer.2017 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017).sql index 60b435556f4..37b4857ab3d 100644 --- a/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2017).sql @@ -2,11 +2,18 @@ -- SqlServer.2017 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017).sql new file mode 100644 index 00000000000..ced5d640ff8 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2017).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2017 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2017 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2017 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2017 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2017 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017).sql index 26dc6613280..2905da2c67e 100644 --- a/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2017).sql @@ -2,38 +2,28 @@ -- SqlServer.2017 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017).sql new file mode 100644 index 00000000000..30355a765af --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2017).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017).sql new file mode 100644 index 00000000000..85401e6b774 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2017).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017).sql index ff0f06eaffa..85401e6b774 100644 --- a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2017).sql @@ -2,17 +2,10 @@ -- SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017).sql index aa61cd436df..be1517c501b 100644 --- a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2017).sql @@ -2,14 +2,10 @@ -- SqlServer.2017 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017).sql new file mode 100644 index 00000000000..4d87b62f964 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2017).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017).sql new file mode 100644 index 00000000000..390f6447d60 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2017).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017).sql new file mode 100644 index 00000000000..be1517c501b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2017).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017).sql new file mode 100644 index 00000000000..57bef4da8d5 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2017).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017).sql new file mode 100644 index 00000000000..ff0f06eaffa --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2017).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017).sql new file mode 100644 index 00000000000..aa61cd436df --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2017).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2017 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 03).sql b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 03).sql index 9f444604625..8a204e1790a 100644 --- a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 03).sql +++ b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 04).sql b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 04).sql index e954020a80f..0df6bfa423c 100644 --- a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 04).sql +++ b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 05).sql b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 05).sql index 969bb5f4222..133ec85da74 100644 --- a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 05).sql +++ b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 06).sql b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 06).sql index 34cad6c33d2..76318f95f5a 100644 --- a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 06).sql +++ b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 07).sql b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 07).sql index fb20efa4c98..f9f3c430d81 100644 --- a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 07).sql +++ b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 12).sql b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 12).sql index ad678a85f00..44922fa69f3 100644 --- a/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 12).sql +++ b/SqlServer.2017/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2017,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2017 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2017 diff --git a/SqlServer.2017/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017).sql b/SqlServer.2017/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017).sql index 037292ced4e..ee757e8b0bd 100644 --- a/SqlServer.2017/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2017).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2017/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017).sql b/SqlServer.2017/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017).sql index b1d6952c07f..aa90ab79ec1 100644 --- a/SqlServer.2017/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2017).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2017 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017).sql b/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017).sql index a76b4858b35..a3451d44e09 100644 --- a/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2017).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017).sql b/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017).sql index b3e47b7e0ca..07cbbde5241 100644 --- a/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2017).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017).sql b/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017).sql index 2102324a0ec..e90c18545d4 100644 --- a/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017).sql +++ b/SqlServer.2017/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2017).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.LinqService,False).sql b/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.LinqService,False).sql index db8a39cfe92..bf1f61c98fe 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.LinqService,False).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.LinqService).sql index b619dcbbb79..9775f793b6f 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.LinqService).sql index ddc93d64b9a..29da89be306 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.LinqService).sql index ed9451bc08b..5277005bfd4 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.LinqService).sql index 7887db3ecbe..770c476d0e6 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.LinqService).sql index 2f53a53c91c..9c81ec30079 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.LinqService).sql index f5d8a280b3f..53a72e90fe4 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.LinqService).sql index edccdac0358..c01c681f3a2 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.LinqService).sql index 4f597d10e9c..70ba53ec005 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.LinqService).sql index 12a0f3937ec..8e4de0949ea 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.LinqService).sql index 694ddb12afe..fe0f0f2cc17 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.LinqService).sql index 92274d96306..59fd62ccc5e 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.LinqService).sql index 032b7568bc1..d60d0876fe2 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.LinqService).sql index 31a2ead3e1a..ed0192d22b0 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.LinqService).sql index 5b55493a6fc..95b25d8f578 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.LinqService).sql index f33bf590b13..2baffdb3011 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.LinqService).sql index 1e312c3bda7..5629f0ffa42 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.LinqService).sql index f9599fc494a..97e8f22347e 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.LinqService).sql index 6ce8c75a0a1..ffdd2b8b3ed 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.LinqService).sql index 09f06cefbd9..54756e0a6e7 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.LinqService).sql index 4119c368f99..8169134ac94 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,1).sql b/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,1).sql index 2950860d3b4..efdacb2a12f 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,1).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,2).sql b/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,2).sql index d3ba232b8d8..cca662a872f 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,2).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.LinqService).sql index 52b14fed024..742fb41879c 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,14).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,14).sql index f4780054684..1609e0e12e5 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,14).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,15).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,15).sql index 96f65885d68..cb137dcc154 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,15).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,14).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,14).sql index f1914f17114..8aab4e65b94 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,14).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,15).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,15).sql index 72851b6069d..b7fdf88de1b 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,15).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,14).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,14).sql index 7ed56bbbd70..3c945d297b0 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,14).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,15).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,15).sql index 40c15d59c28..1a32de3ebbc 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,15).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,14).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,14).sql index 64687e1ad07..335597f47b1 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,14).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,15).sql b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,15).sql index 5d2188f29c6..bfa60640a6d 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,15).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.LinqService).sql index 95b0796d538..92c78dc98b1 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.LinqService).sql index 95b0796d538..92c78dc98b1 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.LinqService).sql index 95b0796d538..92c78dc98b1 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.LinqService).sql index d2023e89eb1..501d31ec071 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.LinqService).sql index d2023e89eb1..501d31ec071 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.LinqService).sql index d2023e89eb1..501d31ec071 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.LinqService).sql index 5e69b1be116..8e7f269aa83 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.LinqService).sql index b0bc3251db1..04428f1f6cd 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2019 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.LinqService).sql index 5a3a1fc09f9..707bd8ff07e 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.LinqService).sql index e9c33ca3a4a..60ae7bef56e 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.LinqService).sql index 15f3cf37a99..69b04475018 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql index be0cc280c0c..9f7dc6c946d 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql index e4402156155..89f2ec9ab51 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql index cc1fb867ed4..f32b7ff76f8 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql index ee010571321..5e8c3d7eacd 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql index a38c6b51e3a..0ca26b04124 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql index 4b9705b0361..ad72cac04ed 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql index b33235599f3..7c205e93b57 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql index 880c594f990..677cc55f29b 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.LinqService).sql index eff8ef3e5dd..1fadd74724d 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.LinqService).sql index 6f276fab96c..04d751e2589 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.LinqService).sql index d7417da7a31..24565965cce 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.LinqService).sql index 8111b6ba4f7..498351f1a8b 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.LinqService).sql index 8111b6ba4f7..07798fb8aa8 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.LinqService).sql index 5e367beae02..2c2c207d323 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.LinqService).sql index 3ce070896e4..efc83826d89 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2019.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..8feb77940be --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..8f8e277c225 --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..c1f148bbba7 --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.LinqService).sql index 12d41d099af..c1f148bbba7 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.LinqService).sql index 53c31e38569..a178ba03036 100644 --- a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..1bf58f0ae8a --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..54b9dcb4a05 --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..a178ba03036 --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..4b22ddf5261 --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..12d41d099af --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.LinqService).sql new file mode 100644 index 00000000000..53c31e38569 --- /dev/null +++ b/SqlServer.2019.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.LinqService).sql index 55914d4ca33..97e1956aca2 100644 --- a/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.LinqService).sql index 3a01817ca91..de53d9caead 100644 --- a/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.LinqService).sql b/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.LinqService).sql index 12b83555c87..6d7cefd125b 100644 --- a/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.LinqService).sql +++ b/SqlServer.2019.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS.LinqService,False).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS.LinqService,False).sql index 8c750d25c72..a58420b1487 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS.LinqService,False).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS.LinqService).sql index 6a72797f43a..619614ad0b0 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS.LinqService).sql index 2fe13a272c2..ca9d11a2677 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS.LinqService).sql index 78fca6ce9bf..0b864611f00 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS.LinqService).sql index 9a9cdab81ca..1a37058019d 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS.LinqService).sql index d583be314ea..60001bc0a19 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS.LinqService).sql index 09b05a60afc..a49a8a85456 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS.LinqService).sql index 75fdc312501..6dec2bebc78 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS.LinqService).sql index 583ff2d24d5..f5532faa74c 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS.LinqService).sql index 30af626e462..5a40c94214c 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS.LinqService).sql index b53c0e870b1..61031710ada 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS.LinqService).sql index c4926564f6c..2a89b00b6a0 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS.LinqService).sql index 9e4ecffbc2f..450de67a77c 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS.LinqService).sql index ad36ef3a18d..71eba97da69 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS.LinqService).sql index fab48e73f42..c3f2f516296 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS.LinqService).sql index 255c2d9c566..6b2d7d7a8a1 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS.LinqService).sql index 708a75df7cf..f5a843ad521 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS.LinqService).sql index bb98393eb9e..b4cbc84f857 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS.LinqService).sql index dec9c2ad70c..e8c83b76e65 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS.LinqService).sql index 4990d58b5ee..119f1726fa2 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS.LinqService).sql index e6ef6f53e7f..5991bdd6e0d 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,1).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,1).sql index f604ad0e8f2..80449abf582 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,1).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,2).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,2).sql index bd27589060d..e921c5e31ba 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,2).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS.LinqService).sql index c281542d30f..f48d54f6086 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,14).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,14).sql index 60ece380927..05eeda0a159 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,14).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,15).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,15).sql index 1584f12c060..185ceabf216 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,15).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,14).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,14).sql index b52af38d66e..941a4172682 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,14).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,15).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,15).sql index da098f1ba20..bd20ca3c195 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,15).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,14).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,14).sql index 928a34abf3c..9b3d5584730 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,14).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,15).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,15).sql index 9009b03abc1..4f8188b9e12 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,15).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,14).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,14).sql index 3bee6bada03..297997fb7b6 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,14).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,15).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,15).sql index d614abb3b24..aaa41cea384 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,15).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS.LinqService).sql index 97415bf6566..bd3a313a097 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS.LinqService).sql index 97415bf6566..bd3a313a097 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS.LinqService).sql index 97415bf6566..bd3a313a097 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS.LinqService).sql index c6dce158693..fe8aac7cebe 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS.LinqService).sql index c6dce158693..fe8aac7cebe 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS.LinqService).sql index c6dce158693..fe8aac7cebe 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS.LinqService).sql index 9f91ee6898b..1f8483ae846 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS.LinqService).sql index fedb26e7621..1a00170ec7c 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS.LinqService).sql index 3abfc4c9e86..975ec428f95 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS.LinqService).sql index da8ad38e9e9..2f34bd5ac25 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS.LinqService).sql index d4206dc5d29..d59841032e4 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql index 38f79df587a..8fe3089701d 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql index c43747f5576..af05c4d5ae9 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql index dee9e7bfd75..3be7452bcbf 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql index bded61b92de..6ba5e35a4f3 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql index 1afe7d36f69..c55e9c8f421 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql index 78243df0dc4..7670e93b65c 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql index d7cb43b424d..8b711cda952 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql index ea32795fe59..a2342997e48 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS.LinqService).sql index 7aad9897cff..af66ea3267b 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS.LinqService).sql index 09f0e4fe5b4..4a417696392 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS.LinqService).sql index 807cc141707..88cb4ea795a 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS.LinqService).sql index 480eaa1295d..a762bd69592 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS.LinqService).sql index 480eaa1295d..2565bde8018 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS.LinqService).sql index 38aa28e9d38..cc0db05b366 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS.LinqService).sql index efd31f357b0..8f34567de40 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..aba4b8f5767 --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..83b01e14f00 --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..fccd694fa92 --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS.LinqService).sql index 9e71044beff..fccd694fa92 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS.LinqService).sql index da3b348bd15..9ab1e0cafbc 100644 --- a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..b5bf08bf63a --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..f59018618af --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..9ab1e0cafbc --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..1cb921ee063 --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..9e71044beff --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.MS.LinqService).sql new file mode 100644 index 00000000000..da3b348bd15 --- /dev/null +++ b/SqlServer.2019.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS.LinqService).sql index 8717dff9695..387547764fc 100644 --- a/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS.LinqService).sql index 5c7f2e504c5..0df57c59626 100644 --- a/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS.LinqService).sql b/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS.LinqService).sql index 5cfadc1b2ab..525140a9dc5 100644 --- a/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS.LinqService).sql +++ b/SqlServer.2019.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019.MS).sql index 334dd9a1b71..7e6a2838a62 100644 --- a/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019.MS).sql index 334dd9a1b71..7e6a2838a62 100644 --- a/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019.MS).sql index beb4cad27ad..564ef6a6377 100644 --- a/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS,False).sql b/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS,False).sql index ded203eb38b..fbe98c3824b 100644 --- a/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS,False).sql +++ b/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019.MS,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS).sql index 6a72797f43a..619614ad0b0 100644 --- a/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019.MS).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS).sql index d303eebb0aa..4b138245b59 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS).sql index d656f6d0d4f..5861b6b6db3 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS).sql index 21a56e7ab71..c9e372832b2 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS).sql index 9879526820a..9b6cd3844bd 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS).sql index db1cebe49b7..f12f9e955d1 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS).sql index 95e90e225c1..ca865d76b61 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS).sql index 758074a02b2..59b2af83f70 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS).sql index 060d9108e7d..8d99a9b7283 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS).sql index f464debf719..ec26ce1a223 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS).sql index df67f6a7ea6..79a47f62a28 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS).sql index c582b478e92..331c54ce9eb 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS).sql index 816687a80c7..dc12ea17f61 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS).sql index fe45761a9fb..4355b5e3ad7 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS).sql index 9f31bd3c2da..1c955b59691 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS).sql index 585c4331de9..525fdd4f2ac 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS).sql index c7759d6c5d0..18681bdab05 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS).sql index 6d24af57778..21f06e7921b 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS).sql index d4e6c04e898..8eb510f1780 100644 --- a/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS).sql index e6ef6f53e7f..5991bdd6e0d 100644 --- a/SqlServer.2019.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,1).sql b/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,1).sql index f604ad0e8f2..80449abf582 100644 --- a/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,1).sql +++ b/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,2).sql b/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,2).sql index bd27589060d..e921c5e31ba 100644 --- a/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,2).sql +++ b/SqlServer.2019.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS).sql index c281542d30f..f48d54f6086 100644 --- a/SqlServer.2019.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019.MS).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,14).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,14).sql index 63ce60d7b2f..ca02a1ec5db 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,14).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,15).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,15).sql index 33722a3f8a2..96a8e030f38 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,15).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,14).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,14).sql index 60417cb8db6..2084206e5c8 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,14).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,15).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,15).sql index 93488f1352b..fd7fe5eaca3 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,15).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,14).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,14).sql index 22278364ac3..ef6ce4bb4cd 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,14).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,15).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,15).sql index 55393f63121..7e348708454 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,15).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,14).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,14).sql index c292555b8db..8e4332b4ef6 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,14).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,15).sql b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,15).sql index b175b5c0d49..235dd2624a0 100644 --- a/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,15).sql +++ b/SqlServer.2019.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS).sql index 97415bf6566..bd3a313a097 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS).sql index 97415bf6566..bd3a313a097 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS).sql index 97415bf6566..bd3a313a097 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS).sql index c6dce158693..fe8aac7cebe 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS).sql index c6dce158693..fe8aac7cebe 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS).sql index c6dce158693..fe8aac7cebe 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS).sql index 9f91ee6898b..1f8483ae846 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019.MS).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS).sql index 548309321a3..5e22a8dad0d 100644 --- a/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019.MS).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019.MS).sql index a37a8bb8e9f..23bf072ae1a 100644 --- a/SqlServer.2019.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS).sql index 3abfc4c9e86..975ec428f95 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS).sql index da8ad38e9e9..2f34bd5ac25 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS).sql index d4206dc5d29..d59841032e4 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql index 38f79df587a..8fe3089701d 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql index c43747f5576..af05c4d5ae9 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql index dee9e7bfd75..3be7452bcbf 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql index bded61b92de..6ba5e35a4f3 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql index 1afe7d36f69..c55e9c8f421 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql index 78243df0dc4..7670e93b65c 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql index d7cb43b424d..8b711cda952 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql index ea32795fe59..a2342997e48 100644 --- a/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS).sql index a49a770c2a7..2131fd5bf4c 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS).sql index 704f7464216..047a8cfddf0 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS).sql index 807cc141707..88cb4ea795a 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS).sql index 480eaa1295d..a762bd69592 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS).sql index 480eaa1295d..2565bde8018 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS).sql index 38aa28e9d38..cc0db05b366 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS).sql index efd31f357b0..8f34567de40 100644 --- a/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..b1765e25fae --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019.MS).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019.MS).sql index fd23aca97a5..d27006058a9 100644 --- a/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..83b01e14f00 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..fccd694fa92 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS).sql index 9e71044beff..fccd694fa92 100644 --- a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS).sql index da3b348bd15..9ab1e0cafbc 100644 --- a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2019.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..b5bf08bf63a --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..f59018618af --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..9ab1e0cafbc --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..1cb921ee063 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..9e71044beff --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.MS).sql new file mode 100644 index 00000000000..da3b348bd15 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 03).sql b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 03).sql index 2a38aa53bd2..4cee949c716 100644 --- a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 03).sql +++ b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 04).sql b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 04).sql index 9bfea1b7ac4..c3d222e467b 100644 --- a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 04).sql +++ b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 05).sql b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 05).sql index 73b282b3f95..5faeacf0211 100644 --- a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 05).sql +++ b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 06).sql b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 06).sql index 6b7710a3201..ca57386af3f 100644 --- a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 06).sql +++ b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 07).sql b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 07).sql index dd2fd5d8c76..9a403703616 100644 --- a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 07).sql +++ b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 12).sql b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 12).sql index 326d4393375..de968dac046 100644 --- a/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 12).sql +++ b/SqlServer.2019.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019.MS SqlServer.2019 diff --git a/SqlServer.2019.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019.MS).sql index b7ec8a83d02..99c5b0417f9 100644 --- a/SqlServer.2019.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019.MS).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2019.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019.MS).sql index fdc5883b31a..115d011f46b 100644 --- a/SqlServer.2019.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019.MS).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2019.MS SqlServer.2019 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS).sql index 8717dff9695..387547764fc 100644 --- a/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS).sql index 5c7f2e504c5..0df57c59626 100644 --- a/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS).sql index 5cfadc1b2ab..525140a9dc5 100644 --- a/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS).sql +++ b/SqlServer.2019.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019).sql index afabe14f19b..46e2a20da04 100644 --- a/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2019).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019).sql index afabe14f19b..46e2a20da04 100644 --- a/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2019).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019).sql index 5c97ad40521..a72ba9ea2d9 100644 --- a/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2019).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019,False).sql b/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019,False).sql index 792cb1c5817..b8ecbdb0efd 100644 --- a/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019,False).sql +++ b/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2019,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019).sql index b619dcbbb79..9775f793b6f 100644 --- a/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2019).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019).sql index 5e57a76e55c..cd11d8c6eab 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019).sql index 5cedebc860d..f0ef79a13b0 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019).sql index bdafab16d48..253a4a589df 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019).sql index 202f1bd37e3..1fd4044efcf 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019).sql index 3b553071b75..62ed58510f7 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019).sql index f5e7f2c5068..0347aa02d57 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019).sql index 36acf68255a..554d12a689f 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019).sql index dd8455f5936..8c51dfdf82f 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019).sql index e7294045f05..5d38597a92d 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019).sql index 9e31a1545c2..de7e2fd622b 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019).sql index bb82d4e3903..42f6ab4c4c3 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019).sql index 2e20776a2b7..54b2665c157 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019).sql index cc61becd77a..afccba738cf 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019).sql index 68666d13589..c7eac3f3662 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019).sql index e693c5e0784..91e1fceedb0 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019).sql index 04ab03b4530..4a7ece0ff66 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019).sql index d2948dea3a7..8248adc436e 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019).sql index 6110ec88cc8..a357760ecd7 100644 --- a/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2019).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019).sql index 4119c368f99..8169134ac94 100644 --- a/SqlServer.2019/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2019).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,1).sql b/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,1).sql index 2950860d3b4..efdacb2a12f 100644 --- a/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,1).sql +++ b/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,2).sql b/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,2).sql index d3ba232b8d8..cca662a872f 100644 --- a/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,2).sql +++ b/SqlServer.2019/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2019,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2019/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019).sql index 52b14fed024..742fb41879c 100644 --- a/SqlServer.2019/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2019).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,14).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,14).sql index a7cecf3545f..206ead5de2f 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,14).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,15).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,15).sql index 4ff02f919ab..6d903ec926e 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,15).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2019,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,14).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,14).sql index cb0a9cdc765..d4684dcfe64 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,14).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,15).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,15).sql index 7b356cd7db1..8fe651470c4 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,15).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2019,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,14).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,14).sql index ab6b7b59245..031667e6b0f 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,14).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,15).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,15).sql index c6723758983..02db70aa68a 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,15).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2019,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,14).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,14).sql index f35c1d488d9..521615293e4 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,14).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,15).sql b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,15).sql index b397b899914..bd44e6e6299 100644 --- a/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,15).sql +++ b/SqlServer.2019/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2019,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019).sql index 95b0796d538..92c78dc98b1 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2019).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019).sql index 95b0796d538..92c78dc98b1 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2019).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019).sql index 95b0796d538..92c78dc98b1 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2019).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019).sql index d2023e89eb1..501d31ec071 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2019).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019).sql index d2023e89eb1..501d31ec071 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2019).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019).sql index d2023e89eb1..501d31ec071 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2019).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019).sql index 5e69b1be116..8e7f269aa83 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2019).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019).sql index f2f60b6cd17..05d8054339b 100644 --- a/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2019).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019).sql index 2df8ef84703..d5f2300daba 100644 --- a/SqlServer.2019/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2019).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019).sql index 5a3a1fc09f9..707bd8ff07e 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2019).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019).sql index e9c33ca3a4a..60ae7bef56e 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2019).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019).sql index 15f3cf37a99..69b04475018 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2019).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql index be0cc280c0c..9f7dc6c946d 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql index e4402156155..89f2ec9ab51 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql @@ -2,13 +2,13 @@ -- SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql index cc1fb867ed4..f32b7ff76f8 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql index ee010571321..5e8c3d7eacd 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql index a38c6b51e3a..0ca26b04124 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2019).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql index 4b9705b0361..ad72cac04ed 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2019).sql @@ -2,13 +2,13 @@ -- SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql index b33235599f3..7c205e93b57 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2019).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql index 880c594f990..677cc55f29b 100644 --- a/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2019).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019).sql index 97bb5d46773..8495250cff1 100644 --- a/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2019).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019).sql index 2be869d54d2..91a821165b7 100644 --- a/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2019).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019).sql index d7417da7a31..24565965cce 100644 --- a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2019).sql @@ -2,11 +2,11 @@ -- SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019).sql index 8111b6ba4f7..498351f1a8b 100644 --- a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2019).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019).sql index 8111b6ba4f7..07798fb8aa8 100644 --- a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2019).sql @@ -2,11 +2,11 @@ -- SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019).sql index 5e367beae02..2c2c207d323 100644 --- a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2019).sql @@ -2,11 +2,11 @@ -- SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019).sql index 3ce070896e4..efc83826d89 100644 --- a/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2019).sql @@ -2,11 +2,18 @@ -- SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019).sql new file mode 100644 index 00000000000..b03f77e452e --- /dev/null +++ b/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2019).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2019 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019).sql index 088b09c776e..e920dc31c7b 100644 --- a/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2019).sql @@ -2,38 +2,28 @@ -- SqlServer.2019 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019).sql new file mode 100644 index 00000000000..8f8e277c225 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2019).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019).sql new file mode 100644 index 00000000000..c1f148bbba7 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2019).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019).sql index 12d41d099af..c1f148bbba7 100644 --- a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2019).sql @@ -2,17 +2,10 @@ -- SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019).sql index 53c31e38569..a178ba03036 100644 --- a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2019).sql @@ -2,14 +2,10 @@ -- SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019).sql new file mode 100644 index 00000000000..1bf58f0ae8a --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2019).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019).sql new file mode 100644 index 00000000000..54b9dcb4a05 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2019).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019).sql new file mode 100644 index 00000000000..a178ba03036 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2019).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019).sql new file mode 100644 index 00000000000..4b22ddf5261 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2019).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019).sql new file mode 100644 index 00000000000..12d41d099af --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2019).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019).sql new file mode 100644 index 00000000000..53c31e38569 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2019).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 03).sql b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 03).sql index f2a31026021..d5be026a214 100644 --- a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 03).sql +++ b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 04).sql b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 04).sql index e3b2bdad79e..421356d2178 100644 --- a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 04).sql +++ b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 05).sql b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 05).sql index 54a59181465..3bd46564497 100644 --- a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 05).sql +++ b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 06).sql b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 06).sql index d8e9eb80165..58d27c6dd48 100644 --- a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 06).sql +++ b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 07).sql b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 07).sql index 431d1694d01..c4696bf8d0c 100644 --- a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 07).sql +++ b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 12).sql b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 12).sql index 1fc3c03c048..3888c2a5235 100644 --- a/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 12).sql +++ b/SqlServer.2019/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2019,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2019 diff --git a/SqlServer.2019/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019).sql b/SqlServer.2019/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019).sql index 02d8d044852..a5209c653ff 100644 --- a/SqlServer.2019/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2019).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2019/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019).sql b/SqlServer.2019/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019).sql index 5f3a73844b9..23ee3da7c0d 100644 --- a/SqlServer.2019/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2019).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2019 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019).sql b/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019).sql index 55914d4ca33..97e1956aca2 100644 --- a/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2019).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019).sql b/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019).sql index 3a01817ca91..de53d9caead 100644 --- a/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2019).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019).sql b/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019).sql index 12b83555c87..6d7cefd125b 100644 --- a/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019).sql +++ b/SqlServer.2019/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2019).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.LinqService,False).sql b/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.LinqService,False).sql index eec48e0887a..dff8d192abb 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.LinqService,False).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2022 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.LinqService).sql index 528d94950dc..8cdefcf5193 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.LinqService).sql index bc9f7ce425a..cdb5eae5bb0 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.LinqService).sql index 601e7e86f52..7ca9a136646 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.LinqService).sql index ddd1f4a68d5..3a3edcddb9c 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.LinqService).sql index 8ea0ffab6c5..d5bdb812c83 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.LinqService).sql index 211b15a6587..2c36bb32184 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.LinqService).sql index f20dac9f43a..66773d08469 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.LinqService).sql index 85f31086d54..61fd78ebbbc 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.LinqService).sql index e020e6299ad..dc81dfb4862 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.LinqService).sql index dad7c26e117..a04034f813d 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.LinqService).sql index b70181b5c10..5c8113e4fc3 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.LinqService).sql index 374565858b8..20eb28f08f5 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.LinqService).sql index 85c649fe598..b0392120f6b 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.LinqService).sql index cb43d071f42..27814cbea7d 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.LinqService).sql index f845427dd57..45fc0a82658 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.LinqService).sql index d44d534ff40..00a6c3e648c 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.LinqService).sql index eafd1003b1a..8c227ac15a4 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.LinqService).sql index a67862227b1..57f8f0bfd4e 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.LinqService).sql index d2d555abbe1..fbb0a26809b 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.LinqService).sql index 0f631bfe325..7cffc6a2443 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,1).sql b/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,1).sql index f5c6ff41ee0..754fef07699 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,1).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,2).sql b/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,2).sql index 574852f3e66..201b5f73df1 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,2).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.LinqService).sql index e5f321754a1..b823f8cae5d 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,14).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,14).sql index 0cee3861852..c4b7af9d4d5 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,14).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,15).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,15).sql index ad64d08c4b5..e98f9663453 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,15).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,14).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,14).sql index 040c641ca75..dd6d16ab38b 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,14).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,15).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,15).sql index d00851a1345..15bdeb66a8b 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,15).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,14).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,14).sql index 562d3ffd6a1..22956718107 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,14).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,15).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,15).sql index e8242104d52..37cd2a19de9 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,15).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,14).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,14).sql index e3302d7326f..e4d6d377fd7 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,14).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,15).sql b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,15).sql index 6a0793dd9f8..a9da211cf47 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,15).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.LinqService).sql index b6f4cb6ff50..9d5c9ca07aa 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.LinqService).sql index b6f4cb6ff50..9d5c9ca07aa 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.LinqService).sql index b6f4cb6ff50..9d5c9ca07aa 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.LinqService).sql index 4dc372bee77..87880741776 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.LinqService).sql index 4dc372bee77..87880741776 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.LinqService).sql index 4dc372bee77..87880741776 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.LinqService).sql index d45aae8abad..93d69c2da7f 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.LinqService).sql index 21a02f168c6..0305c64175f 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2022 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.LinqService).sql index 857e80c33af..4bf7094a444 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.LinqService).sql index c1daee7a16a..ee181a06688 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.LinqService).sql index 70c5c0f09f1..9d1d14d0bd1 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql index 1ffe21d2495..69105f9bf70 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql index c8907670d1e..ef6db22bbaf 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql index 0d608fb45fe..feed31608ea 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql index 2228c2c2f81..04348033cd6 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql index 755e6e9fc39..ebbae44814e 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql index e3b9b1d307f..88b47ac06a3 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql index e8b72a378d2..c39acfa2dc8 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql index 1433964594e..3ba0c6c3938 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.LinqService).sql index d1bf90bc6b9..8a381581a34 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.LinqService).sql index 5aedb241699..e1d9e14f3eb 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.LinqService).sql index 3ef193ce58f..01a6df075de 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.LinqService).sql index 9aee49f8b34..c0e40711ea6 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.LinqService).sql index 9aee49f8b34..ffbb58ca793 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.LinqService).sql index 10fcf29f7fe..262f585bff3 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.LinqService).sql index 24b3e9467ee..a2d40112465 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2022 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2022.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..f28d5d59b85 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2022 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..746f2f89937 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..1b4c863e792 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.LinqService).sql index 51a5924fab4..1b4c863e792 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.LinqService).sql index 029266200b1..59f94e66a79 100644 --- a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..a9ec9523956 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..3601f70775e --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..59f94e66a79 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..f49dd6d230e --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..51a5924fab4 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.LinqService).sql new file mode 100644 index 00000000000..029266200b1 --- /dev/null +++ b/SqlServer.2022.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.LinqService).sql index 55857c7679a..341d373d2c7 100644 --- a/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.LinqService).sql index 1ae218d4923..4fd97bc3974 100644 --- a/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.LinqService).sql b/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.LinqService).sql index f5dc4510846..7720b47d952 100644 --- a/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.LinqService).sql +++ b/SqlServer.2022.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS.LinqService,False).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS.LinqService,False).sql index 1da3900a6c7..d3e137e6b79 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS.LinqService,False).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS.LinqService).sql index 48849195340..e34c4b86682 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS.LinqService).sql index 305627674d2..a1a6f01c5a1 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS.LinqService).sql index d8405a35729..bb82076df5b 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS.LinqService).sql index cba16b8cf14..b90491a68ba 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS.LinqService).sql index 72c204d7e09..4ac46bc9892 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS.LinqService).sql index 35f33a3b610..a6717374446 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS.LinqService).sql index 1107f8c326a..f36d5c0979f 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS.LinqService).sql index 7d144537f94..02a4f757602 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS.LinqService).sql index acb7e85ef51..2cf60f16f83 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS.LinqService).sql index 2089be71c96..02da7848810 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS.LinqService).sql index 6e473bcea04..e5e07af56bc 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS.LinqService).sql index ff1b8dbb35f..de7a59f82ae 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS.LinqService).sql index bec0307b658..be28b6d859c 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS.LinqService).sql index ca4aff04f83..7612368c685 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS.LinqService).sql index 2254a725ff0..c389df326ed 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS.LinqService).sql index 353300d0680..1ad1f8dd63c 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS.LinqService).sql index 4413ed2080d..cc30c09883f 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS.LinqService).sql index d09a09ec8d7..204cc6032d9 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS.LinqService).sql index 8b47fc3e953..78404a936ff 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS.LinqService).sql index 73663c787e0..21cad790212 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,1).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,1).sql index f7b12a25c8a..8c49031dfc2 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,1).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,2).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,2).sql index 5c59f0c1252..a761355ad92 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,2).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS.LinqService).sql index 6a7de1b8bce..2a6c918cb7c 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,14).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,14).sql index 00c3f4c43e7..924c8680dc8 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,14).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,15).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,15).sql index 18ec7e33554..f21e8a2bf97 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,15).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,14).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,14).sql index 73f6361fe80..5b9c276a718 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,14).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,15).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,15).sql index cc0b82f076f..396e2467153 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,15).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,14).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,14).sql index 34e9df20361..7eee293bb9b 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,14).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,15).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,15).sql index 5aad5be54af..795d8070c24 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,15).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,14).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,14).sql index de143ba8896..3a44810ddd4 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,14).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,15).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,15).sql index 53928386859..cba648b620f 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,15).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS.LinqService).sql index 7f4d43edd80..ed9020a1c92 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS.LinqService).sql index 7f4d43edd80..ed9020a1c92 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS.LinqService).sql index 7f4d43edd80..ed9020a1c92 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS.LinqService).sql index 51bd9ab0271..2bcf51e5bb5 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS.LinqService).sql index 51bd9ab0271..2bcf51e5bb5 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS.LinqService).sql index 51bd9ab0271..2bcf51e5bb5 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS.LinqService).sql index fb164b2b11e..47bd907a946 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS.LinqService).sql index 7b26242dd94..3dbf94092dc 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS.LinqService).sql index 35bc8da44cd..d517fdf3dc6 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS.LinqService).sql index c76388854ca..21adebfad91 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS.LinqService).sql index 48bdf13836f..d425cf64de7 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql index a084e565e84..3a66ae3616b 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql index b4683b5457b..1c94dfb1ff9 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql index 538413df9a0..8b1f9af1185 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql index c4cba50acce..0988e46eac2 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql index a27978a971a..5530fdb2850 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql index ff49b00cbcc..bc1ddece23a 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql index e059c196b93..e11e42fd896 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql index dd01a94c8da..dcce783dc43 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS.LinqService).sql index a262b1736af..1c3133d4988 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS.LinqService).sql index b05fd37a77c..c7d8a6e06d5 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS.LinqService).sql index ed634cfcc89..ce27b3f9854 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS.LinqService).sql index 1a9d5cbf430..11bda6aa0c0 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS.LinqService).sql index 1a9d5cbf430..b166a695c65 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS.LinqService).sql index 64da8fbfbfd..4a982c264e2 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS.LinqService).sql index 90b5ff13649..63d68db2bea 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..f3ce9d185b7 --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..4433ff1791a --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..40110a1547a --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS.LinqService).sql index efe04f2f4a9..40110a1547a 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS.LinqService).sql index 04b0c9b3d57..4d153d0ae16 100644 --- a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..4f57f263ac8 --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..8a6b14b966d --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..4d153d0ae16 --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..7669087297e --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..efe04f2f4a9 --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.MS.LinqService).sql new file mode 100644 index 00000000000..04b0c9b3d57 --- /dev/null +++ b/SqlServer.2022.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS.LinqService).sql index 0930664c364..87f965cb0e4 100644 --- a/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS.LinqService).sql index 27a92a59206..dab4b24f790 100644 --- a/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS.LinqService).sql b/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS.LinqService).sql index ccd01d7c2f2..5374379a991 100644 --- a/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS.LinqService).sql +++ b/SqlServer.2022.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022.MS).sql index 8d40963fe9b..b23bcd99327 100644 --- a/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022.MS).sql index 8d40963fe9b..b23bcd99327 100644 --- a/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022.MS).sql index 6544cb56aa0..75f62f40e45 100644 --- a/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS,False).sql b/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS,False).sql index ce6aae0fd4a..cfca14f6782 100644 --- a/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS,False).sql +++ b/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022.MS,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS).sql index 48849195340..e34c4b86682 100644 --- a/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022.MS).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS).sql index 6742edd5bfd..aa4c3bb7edb 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS).sql index b8592d04c6e..893ba377a37 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS).sql index 8d33d0ea360..c5508876e7e 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS).sql index 4a770a3191a..55310f1879b 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS).sql index d85b68c6f12..32179d3b123 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS).sql index 88a0dd2187d..8cab95836b7 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS).sql index 8ead165f8ef..9ae91746fab 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS).sql index 8bd9032e178..21e85c0a315 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS).sql index 5767beeca90..291006067a4 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS).sql index c74a3b5e219..9672043d72c 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS).sql index 7ae8758744a..20df3f77080 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS).sql index f68e4ae5310..9ec92f3516f 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS).sql index 2c9efd80c18..20582836ea5 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS).sql index 26503c29eab..b151bacf6bc 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS).sql index 529e058e7bd..4ca8705ceb9 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS).sql index e2a4564cdb5..c9f1ef560c0 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS).sql index 8e97ca7f1d9..1cdfc56738d 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS).sql index 596962af116..6e512c8ea91 100644 --- a/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS).sql index 73663c787e0..21cad790212 100644 --- a/SqlServer.2022.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,1).sql b/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,1).sql index f7b12a25c8a..8c49031dfc2 100644 --- a/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,1).sql +++ b/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,2).sql b/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,2).sql index 5c59f0c1252..a761355ad92 100644 --- a/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,2).sql +++ b/SqlServer.2022.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS).sql index 6a7de1b8bce..2a6c918cb7c 100644 --- a/SqlServer.2022.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022.MS).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,14).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,14).sql index f11e5b80d84..f98f63400e1 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,14).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,15).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,15).sql index 50914057833..74e2303be57 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,15).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,14).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,14).sql index 6a7836608ab..bb010694809 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,14).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,15).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,15).sql index ee3c8b897d4..ee66e4df79b 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,15).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,14).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,14).sql index 1d8411219be..156c3f478bc 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,14).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,15).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,15).sql index b5010536a4d..bd9454888bc 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,15).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,14).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,14).sql index 1d4fc98d1ea..02440be9ca4 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,14).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,15).sql b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,15).sql index 49a05d2b0ba..de47a158ea9 100644 --- a/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,15).sql +++ b/SqlServer.2022.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS).sql index 7f4d43edd80..ed9020a1c92 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS).sql index 7f4d43edd80..ed9020a1c92 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS).sql index 7f4d43edd80..ed9020a1c92 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS).sql index 51bd9ab0271..2bcf51e5bb5 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS).sql index 51bd9ab0271..2bcf51e5bb5 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS).sql index 51bd9ab0271..2bcf51e5bb5 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS).sql index fb164b2b11e..47bd907a946 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022.MS).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS).sql index 743e9bf68be..6c9cd9fab1d 100644 --- a/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022.MS).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022.MS).sql index ef234c44ded..8d0c8761123 100644 --- a/SqlServer.2022.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS).sql index 35bc8da44cd..d517fdf3dc6 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS).sql index c76388854ca..21adebfad91 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS).sql index 48bdf13836f..d425cf64de7 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql index a084e565e84..3a66ae3616b 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql index b4683b5457b..1c94dfb1ff9 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql index 538413df9a0..8b1f9af1185 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql index c4cba50acce..0988e46eac2 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql index a27978a971a..5530fdb2850 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql index ff49b00cbcc..bc1ddece23a 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql index e059c196b93..e11e42fd896 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql index dd01a94c8da..dcce783dc43 100644 --- a/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS).sql index 0f7bffb1afd..f0f1e333799 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS).sql index d1c1db705f0..6c14ab6601d 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS).sql index ed634cfcc89..ce27b3f9854 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS).sql index 1a9d5cbf430..11bda6aa0c0 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS).sql index 1a9d5cbf430..b166a695c65 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS).sql index 64da8fbfbfd..4a982c264e2 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS).sql index 90b5ff13649..63d68db2bea 100644 --- a/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..9d7df0b96db --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022.MS).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022.MS).sql index 210eed5d25a..2fcc84f69be 100644 --- a/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..4433ff1791a --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..40110a1547a --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS).sql index efe04f2f4a9..40110a1547a 100644 --- a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS).sql index 04b0c9b3d57..4d153d0ae16 100644 --- a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.2022.MS SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..4f57f263ac8 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..8a6b14b966d --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..4d153d0ae16 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..7669087297e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..efe04f2f4a9 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.MS).sql new file mode 100644 index 00000000000..04b0c9b3d57 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 03).sql b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 03).sql index 3fdbef2f167..f0967e0a89a 100644 --- a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 03).sql +++ b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 04).sql b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 04).sql index 24c02126aaf..93ee39e3c4f 100644 --- a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 04).sql +++ b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 05).sql b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 05).sql index efdedff31ce..dbed9ac10c9 100644 --- a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 05).sql +++ b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 06).sql b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 06).sql index ea1843b81e1..c5c699a303b 100644 --- a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 06).sql +++ b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 07).sql b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 07).sql index 41741ec8483..9ffef6f34c6 100644 --- a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 07).sql +++ b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 12).sql b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 12).sql index 9c6deb6c739..8e407d9e13f 100644 --- a/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 12).sql +++ b/SqlServer.2022.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022.MS SqlServer.2022 diff --git a/SqlServer.2022.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022.MS).sql index ba4545544b6..ac3dba1c163 100644 --- a/SqlServer.2022.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022.MS).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2022.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022.MS).sql index 9b59d5ebc47..1ed1d173fc0 100644 --- a/SqlServer.2022.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022.MS).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2022.MS SqlServer.2022 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS).sql index 0930664c364..87f965cb0e4 100644 --- a/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS).sql index 27a92a59206..dab4b24f790 100644 --- a/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS).sql index ccd01d7c2f2..5374379a991 100644 --- a/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS).sql +++ b/SqlServer.2022.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022).sql index 1296183cc1f..8a1d8a77d3c 100644 --- a/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.2022).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022).sql index 1296183cc1f..8a1d8a77d3c 100644 --- a/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.2022).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022).sql index 299ed296ecf..b3936c7286e 100644 --- a/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.2022).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022,False).sql b/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022,False).sql index f81b430e655..6e1c1f8a1e0 100644 --- a/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022,False).sql +++ b/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.2022,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.2022 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022).sql index 528d94950dc..8cdefcf5193 100644 --- a/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.2022).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022).sql index c184699eb15..b76612f2049 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022).sql index 779a1455e3a..c48d9c70b13 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022).sql index 527328bbb7e..e2069e0375a 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022).sql index 0da8a5f06a0..fc1a435649e 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022).sql index 84b6f462599..3d877c41c82 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022).sql index 9bcaa1e67ee..a68c530084e 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022).sql index 809466b0a67..204532ff3e5 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022).sql index eb03e6d2627..6f3f18a68d3 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022).sql index 19c52548ee3..cc848198163 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022).sql index 2cb0e30e5b2..127475c8126 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022).sql index 7d0925d76e6..de1749908d4 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022).sql index 2ea5b29571a..ca27a3af3ea 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022).sql index bbf22abc57e..d9c1952a2d2 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022).sql index 99328162080..9c159129179 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022).sql index 374ffc0068e..a057cbba6ad 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022).sql index 68081bafa00..4d04ed25624 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022).sql index 87d3793f444..23455a8dd77 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022).sql index 5e9a76073d2..c892dd2211b 100644 --- a/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.2022).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022).sql index 0f631bfe325..7cffc6a2443 100644 --- a/SqlServer.2022/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.2022).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,1).sql b/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,1).sql index f5c6ff41ee0..754fef07699 100644 --- a/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,1).sql +++ b/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,2).sql b/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,2).sql index 574852f3e66..201b5f73df1 100644 --- a/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,2).sql +++ b/SqlServer.2022/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.2022,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.2022/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022).sql index e5f321754a1..b823f8cae5d 100644 --- a/SqlServer.2022/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.2022).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,14).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,14).sql index 2c176a71da0..fcd7facf617 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,14).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,15).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,15).sql index 95156cc61fe..bae374a5893 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,15).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.2022,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,14).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,14).sql index 763bc759511..49402026dce 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,14).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,15).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,15).sql index 1dea9edd3eb..dd2f6b2b006 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,15).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.2022,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,14).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,14).sql index 115932d504e..4cf014f2266 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,14).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,15).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,15).sql index 12aa6265aec..9ab9fee6079 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,15).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.2022,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,14).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,14).sql index 918339a71a7..33417cb9018 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,14).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,15).sql b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,15).sql index 3c8cd062405..a239373b009 100644 --- a/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,15).sql +++ b/SqlServer.2022/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.2022,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022).sql index b6f4cb6ff50..9d5c9ca07aa 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.2022).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022).sql index b6f4cb6ff50..9d5c9ca07aa 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.2022).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022).sql index b6f4cb6ff50..9d5c9ca07aa 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.2022).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022).sql index 4dc372bee77..87880741776 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.2022).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022).sql index 4dc372bee77..87880741776 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.2022).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022).sql index 4dc372bee77..87880741776 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.2022).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022).sql index d45aae8abad..93d69c2da7f 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.2022).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022).sql index 07dce63b88d..f19653e3c0e 100644 --- a/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.2022).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022).sql index bdd507beab1..c4905f3509c 100644 --- a/SqlServer.2022/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.2022).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022).sql index 857e80c33af..4bf7094a444 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.2022).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022).sql index c1daee7a16a..ee181a06688 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.2022).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022).sql index 70c5c0f09f1..9d1d14d0bd1 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.2022).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql index 1ffe21d2495..69105f9bf70 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql index c8907670d1e..ef6db22bbaf 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql @@ -2,13 +2,13 @@ -- SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql index 0d608fb45fe..feed31608ea 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql index 2228c2c2f81..04348033cd6 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql index 755e6e9fc39..ebbae44814e 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.2022).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql index e3b9b1d307f..88b47ac06a3 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.2022).sql @@ -2,13 +2,13 @@ -- SqlServer.2022 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql index e8b72a378d2..c39acfa2dc8 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.2022).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql index 1433964594e..3ba0c6c3938 100644 --- a/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.2022).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022).sql index 0b026e7036b..61cd10ab548 100644 --- a/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.2022).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022).sql index 9a3b8181b07..c24b4d47ef1 100644 --- a/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.2022).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022).sql index 3ef193ce58f..01a6df075de 100644 --- a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.2022).sql @@ -2,11 +2,11 @@ -- SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022).sql index 9aee49f8b34..c0e40711ea6 100644 --- a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.2022).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022).sql index 9aee49f8b34..ffbb58ca793 100644 --- a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.2022).sql @@ -2,11 +2,11 @@ -- SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022).sql index 10fcf29f7fe..262f585bff3 100644 --- a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.2022).sql @@ -2,11 +2,11 @@ -- SqlServer.2022 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022).sql index 24b3e9467ee..a2d40112465 100644 --- a/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.2022).sql @@ -2,11 +2,18 @@ -- SqlServer.2022 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022).sql new file mode 100644 index 00000000000..15fe131f92e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.2022).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.2022 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.2022 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.2022 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.2022 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.2022 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022).sql index e37cdfb4640..c259c180c2f 100644 --- a/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.2022).sql @@ -2,38 +2,28 @@ -- SqlServer.2022 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022).sql new file mode 100644 index 00000000000..746f2f89937 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.2022).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022).sql new file mode 100644 index 00000000000..1b4c863e792 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.2022).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022).sql index 51a5924fab4..1b4c863e792 100644 --- a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.2022).sql @@ -2,17 +2,10 @@ -- SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022).sql index 029266200b1..59f94e66a79 100644 --- a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.2022).sql @@ -2,14 +2,10 @@ -- SqlServer.2022 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022).sql new file mode 100644 index 00000000000..a9ec9523956 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.2022).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022).sql new file mode 100644 index 00000000000..3601f70775e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.2022).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022).sql new file mode 100644 index 00000000000..59f94e66a79 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.2022).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022).sql new file mode 100644 index 00000000000..f49dd6d230e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.2022).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022).sql new file mode 100644 index 00000000000..51a5924fab4 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.2022).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022).sql new file mode 100644 index 00000000000..029266200b1 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.2022).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.2022 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 03).sql b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 03).sql index d5694c2dada..7a552eebab7 100644 --- a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 03).sql +++ b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 04).sql b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 04).sql index 0eee8ada5f4..52b648f15df 100644 --- a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 04).sql +++ b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 05).sql b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 05).sql index 8b0ee4283a1..9222bc58816 100644 --- a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 05).sql +++ b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 06).sql b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 06).sql index f7b6f7af2a9..8860368f4b0 100644 --- a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 06).sql +++ b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 07).sql b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 07).sql index 80ddb045475..aa62133902d 100644 --- a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 07).sql +++ b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 12).sql b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 12).sql index e272b7bfdfb..1ea37fed3b5 100644 --- a/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 12).sql +++ b/SqlServer.2022/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.2022,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.2022 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.2022 diff --git a/SqlServer.2022/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022).sql b/SqlServer.2022/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022).sql index 54109606f31..588fc8b7975 100644 --- a/SqlServer.2022/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.2022).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.2022/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022).sql b/SqlServer.2022/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022).sql index f070c146ca5..fbfed8d8c96 100644 --- a/SqlServer.2022/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.2022).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.2022 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022).sql b/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022).sql index 55857c7679a..341d373d2c7 100644 --- a/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.2022).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022).sql b/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022).sql index 1ae218d4923..4fd97bc3974 100644 --- a/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.2022).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022).sql b/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022).sql index f5dc4510846..7720b47d952 100644 --- a/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022).sql +++ b/SqlServer.2022/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.2022).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.LinqService,False).sql b/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.LinqService,False).sql index 098e7f9b4c9..06ad382721e 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.LinqService,False).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.LinqService).sql index c3501a6ffbe..d10fb1e1a4d 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.LinqService).sql index ef6a0082982..b59bcc82bed 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.LinqService).sql index 1541c1b01e9..2114cf433e2 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.LinqService).sql index 8d3ea4e9a69..d898e685f88 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.LinqService).sql index 5737f3c2543..7fb87c4a1bf 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.LinqService).sql index f0531ddd036..c93ad43809e 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.LinqService).sql index 97ebfe09117..a5312a8b660 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.LinqService).sql index 2d33255d199..27cfcfdb8be 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.LinqService).sql index beaf88956b5..d412ac315b9 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.LinqService).sql index d03c0c3f0d3..5d70f99bbb7 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.LinqService).sql index da11b448ef5..56481be51c9 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.LinqService).sql index e27e4cff0bc..97b604941bc 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.LinqService).sql index 62ca8e57647..05df5e7a973 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.LinqService).sql index e92bb3b1b01..75a2ceffff1 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.LinqService).sql index 3b2bd01543b..d15ab36dac7 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.LinqService).sql index 37eaf34e0a0..90df65e5811 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.LinqService).sql index df2b93d19ea..c5aa1227568 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.LinqService).sql index 694364f6359..265e7f46cb7 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.LinqService).sql index cb25adffa63..5a6d588fd21 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.LinqService).sql index b51e60f89bb..c7e645fa25e 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,1).sql b/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,1).sql index 74e145cf891..b4b6a542179 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,1).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,2).sql b/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,2).sql index f6fffa0db67..dcb3853f306 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,2).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.LinqService).sql index 9dbb27395dd..3d2c3c79e1a 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,14).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,14).sql index 283e846857b..925912bddae 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,14).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,15).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,15).sql index 2180f402f27..98c36ffa940 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,15).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,14).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,14).sql index 7f054a81a3d..7705b061e91 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,14).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,15).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,15).sql index 7e22d1925d4..0be03087d75 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,15).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,14).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,14).sql index 03f80df241e..ef5b4a30662 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,14).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,15).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,15).sql index 2359b480dc2..ba041a07271 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,15).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,14).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,14).sql index 6f89bc6eb6a..7b92c8a53c7 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,14).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,15).sql b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,15).sql index 7f0dd58dafe..8930cdf729d 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,15).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.LinqService).sql index 3d7605b2531..71aa64f6e6b 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.LinqService).sql index 3d7605b2531..71aa64f6e6b 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.LinqService).sql index 3d7605b2531..71aa64f6e6b 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.LinqService).sql index 4faa461b873..2dd9b981c38 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.LinqService).sql index 4faa461b873..2dd9b981c38 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.LinqService).sql index 4faa461b873..2dd9b981c38 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.LinqService).sql index c051500dfc3..4336140434d 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.LinqService).sql index 704329df157..e22e0fb4c46 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.LinqService).sql index 2cb4a498df0..0db4c7cac5b 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.LinqService).sql index 8d259c85e87..19f52c698c0 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.LinqService).sql index 87872ac26bd..4ce3274cb5c 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql index 36a40cc6076..59595b34682 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql index d7db8ed3467..d26026d48ca 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql index 06003096bd6..63879faeb8c 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql index 94fac59b0c2..135f3c710f5 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql index 8cb6a671f92..75ad7bfec05 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql index 352ac9c29ef..e315da4fa94 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql index ee87502518b..3d2f381a7d6 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql index 6ed7416b9a4..66cd2e28f23 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.LinqService).sql index 11bc1908ef5..3c7a2d13b60 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.LinqService).sql index 6ed9f433f7d..5ea4a33503d 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.LinqService).sql index b17ed827e7d..1a21559e3a5 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.LinqService).sql index 1a2c3f09f3e..cd033f8b15c 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.LinqService).sql index 1a2c3f09f3e..2793acac062 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.LinqService).sql index 1b23e636ff9..09a0a0d4d20 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.LinqService).sql index 6e780c2773d..76de44afc71 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.Contained.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..21fb526f98e --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..2720f8467f3 --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..03c93673afc --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.LinqService).sql index 75a3d3ebe9d..03c93673afc 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.LinqService).sql index d5fa1951922..b21ffbc7b5a 100644 --- a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..13608184372 --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..36ca30d68d4 --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..b21ffbc7b5a --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..45d1354d6ca --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..75a3d3ebe9d --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.LinqService).sql new file mode 100644 index 00000000000..d5fa1951922 --- /dev/null +++ b/SqlServer.Contained.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.LinqService).sql index 9dcee30a5ea..a60facf1a22 100644 --- a/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.LinqService).sql index 448618f53e9..d5c65db583c 100644 --- a/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.LinqService).sql b/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.LinqService).sql index b9ada8a4f3b..55ef9664d9e 100644 --- a/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.LinqService).sql +++ b/SqlServer.Contained.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS.LinqService,False).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS.LinqService,False).sql index 5b7e318c56a..c594bb3fc31 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS.LinqService,False).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS.LinqService).sql index 54596a0f273..34e1c69824f 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS.LinqService).sql index 8c94d67688c..255c8750420 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS.LinqService).sql index ee1ddea1a16..4683adf4d1d 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS.LinqService).sql index f997b6aa535..e05f93918a7 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS.LinqService).sql index 9d3bee0d00a..1e3c55e96de 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS.LinqService).sql index 2715947facf..dac45f2eb79 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS.LinqService).sql index bef094f3081..c48c9cea228 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS.LinqService).sql index 7356c9f7a3f..a415cf524bf 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS.LinqService).sql index 458f237979d..2333e1fe0cc 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS.LinqService).sql index 6c60e414179..f30bf3b5dc3 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS.LinqService).sql index 6b7e44ba87b..e163c512349 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS.LinqService).sql index 446551a36e8..a975c1f0360 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS.LinqService).sql index ff54357dc3c..66b47f32b35 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS.LinqService).sql index 484177f3f32..5a1ea530823 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS.LinqService).sql index eb9b943ec77..f4583cf5933 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS.LinqService).sql index d345bc0184a..fc8a98c094b 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS.LinqService).sql index 5bc9f70c30e..b43817bfe30 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS.LinqService).sql index 5332adc7511..45658e9acb8 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS.LinqService).sql index 83839bb2b5e..eca6f2bb00a 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS.LinqService).sql index 63581f9c75f..c4048316a19 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,1).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,1).sql index 7313b66db9b..b2cba772904 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,1).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,2).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,2).sql index 3fbf68d9aa7..c5524deec97 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,2).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS.LinqService).sql index 7cdca7e6c96..aa0b7113d1e 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,14).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,14).sql index 5c06f746723..ae009a6295e 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,14).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,15).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,15).sql index d169edf6b69..54fe982fa15 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,15).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,14).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,14).sql index 4acc068a3e2..1d26f2d45ed 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,14).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,15).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,15).sql index 7ce55096592..af2964b8755 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,15).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,14).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,14).sql index 9383cdfddb2..25c68965eb8 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,14).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,15).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,15).sql index c160cfe9798..d6bb36bd64d 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,15).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,14).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,14).sql index 76c50cf56ef..feab320ea17 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,14).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,15).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,15).sql index 9e23265f57a..b16e2f6e2d4 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,15).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS.LinqService).sql index c40e19cee51..3b627fd0943 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS.LinqService).sql index c40e19cee51..3b627fd0943 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS.LinqService).sql index c40e19cee51..3b627fd0943 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS.LinqService).sql index 7c997ad23f0..6b88ee5ef11 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS.LinqService).sql index 7c997ad23f0..6b88ee5ef11 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS.LinqService).sql index 7c997ad23f0..6b88ee5ef11 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS.LinqService).sql index 45575c4464e..5273900dc4e 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS.LinqService).sql index 4ee6e607d00..225b475ad76 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS.LinqService).sql index 25e5846e25f..e05b2748f64 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS.LinqService).sql index f278e0a3c32..b033579e2dd 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS.LinqService).sql index 474855b9b67..035a064969a 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql index e9c8dc15144..5f96d2463ef 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql index 521a6406136..138c5ff788a 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql index 1d40896b683..6998a1277a0 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql index 8d61d1439bc..216fa8e5546 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql index f11742af04e..3e9808342b8 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql index 538f1181b14..905d2de1ed4 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql index b53c2cc3baa..e059260a8a6 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql index cb108fec02b..c7640d00969 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS.LinqService).sql index 810fb1042a8..756a81309ea 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS.LinqService).sql index 5ccc316df36..511df4fd991 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS.LinqService).sql index 9ee98ab6b8b..8ebeb9e9e67 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS.LinqService).sql index 16c7e40ed1d..ba868aba074 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS.LinqService).sql index 16c7e40ed1d..8e59c2319ba 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS.LinqService).sql index 779d62201eb..f8e9f4451a0 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS.LinqService).sql index bc7d317f011..ce3ef86128f 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..6c07c57bc05 --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..94d06f98e32 --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..0246ba3d7a1 --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS.LinqService).sql index 7595b1a2bb2..0246ba3d7a1 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS.LinqService).sql index 1251dc6dded..14674b6b0cf 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..028d9560614 --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..b5a9fb1d6dd --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..14674b6b0cf --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..001af5273a3 --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..7595b1a2bb2 --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.MS.LinqService).sql new file mode 100644 index 00000000000..1251dc6dded --- /dev/null +++ b/SqlServer.Contained.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS.LinqService).sql index 9e7afe1f081..7764fdd8f13 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS.LinqService).sql index 821d2be312d..e844f2eb2fb 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS.LinqService).sql b/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS.LinqService).sql index 2f32265a187..923339cf657 100644 --- a/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS.LinqService).sql +++ b/SqlServer.Contained.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained.MS).sql index eef40dc9606..efccd3f1373 100644 --- a/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained.MS).sql index eef40dc9606..efccd3f1373 100644 --- a/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained.MS).sql index 8abcaf787b4..fc97e2de3c8 100644 --- a/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS,False).sql b/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS,False).sql index 66b5fa748bc..dcb6641945e 100644 --- a/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS,False).sql +++ b/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained.MS,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS).sql index 54596a0f273..34e1c69824f 100644 --- a/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained.MS).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS).sql index c231e2183cf..b84ebf3b844 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS).sql index 5a4b6df8e5d..fa59449752d 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS).sql index 44a34655745..f19b801038c 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS).sql index 8af535d7e20..923524f9256 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS).sql index b4a6302ce68..1fac883b58d 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS).sql index 0b6f3f036b2..6d18e948a5c 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS).sql index ea7e4b1a57d..c6c2fb4edb9 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS).sql index 17f98df3a20..f2ae4ad93ae 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS).sql index c356d969cd5..a392103c380 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS).sql index 8c1cbe3428c..e2f07e58809 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS).sql index e94526ebd1d..873e602f6d5 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS).sql index 05886ed5630..6f8b72d40d0 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS).sql index d596038e8ba..1f550e8bd4b 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS).sql index 65df4281e65..5aba5c2b807 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS).sql index 67342b94945..269344db9f1 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS).sql index bf381a150f6..6249bcdfc8a 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS).sql index 351b201a9b4..148ea6ad1e9 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS).sql index 5520edabf47..4aee2144baa 100644 --- a/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS).sql index 63581f9c75f..c4048316a19 100644 --- a/SqlServer.Contained.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,1).sql b/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,1).sql index 7313b66db9b..b2cba772904 100644 --- a/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,1).sql +++ b/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,2).sql b/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,2).sql index 3fbf68d9aa7..c5524deec97 100644 --- a/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,2).sql +++ b/SqlServer.Contained.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS).sql index 7cdca7e6c96..aa0b7113d1e 100644 --- a/SqlServer.Contained.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained.MS).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,14).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,14).sql index aeb3dde68f8..190b51d0337 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,14).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,15).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,15).sql index 19f12aa8a25..ea9e4fa75ae 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,15).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,14).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,14).sql index 3a352b9a4f3..69744edbac5 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,14).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,15).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,15).sql index f6e48b2d0d8..0dbc361332a 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,15).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,14).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,14).sql index 0da7da17b20..2a81d6d9bfe 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,14).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,15).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,15).sql index db41d9211f4..a939301898f 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,15).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,14).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,14).sql index b91fe425df8..7311a926487 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,14).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,15).sql b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,15).sql index 41bdea02bf2..07610621805 100644 --- a/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,15).sql +++ b/SqlServer.Contained.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS).sql index c40e19cee51..3b627fd0943 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS).sql index c40e19cee51..3b627fd0943 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS).sql index c40e19cee51..3b627fd0943 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS).sql index 7c997ad23f0..6b88ee5ef11 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS).sql index 7c997ad23f0..6b88ee5ef11 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS).sql index 7c997ad23f0..6b88ee5ef11 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS).sql index 45575c4464e..5273900dc4e 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained.MS).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS).sql index bfc864900d9..b4bea2ff1f2 100644 --- a/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained.MS).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained.MS).sql index effbc1488f4..cea59070f2b 100644 --- a/SqlServer.Contained.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS).sql index 25e5846e25f..e05b2748f64 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS).sql index f278e0a3c32..b033579e2dd 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS).sql index 474855b9b67..035a064969a 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql index e9c8dc15144..5f96d2463ef 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql index 521a6406136..138c5ff788a 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql index 1d40896b683..6998a1277a0 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql index 8d61d1439bc..216fa8e5546 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql index f11742af04e..3e9808342b8 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql index 538f1181b14..905d2de1ed4 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql index b53c2cc3baa..e059260a8a6 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql index cb108fec02b..c7640d00969 100644 --- a/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS).sql index 41127ad751d..b735410ff1b 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS).sql index 79ed4cfc465..390305df5ec 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS).sql index 9ee98ab6b8b..8ebeb9e9e67 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS).sql index 16c7e40ed1d..ba868aba074 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS).sql index 16c7e40ed1d..8e59c2319ba 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS).sql index 779d62201eb..f8e9f4451a0 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS).sql index bc7d317f011..ce3ef86128f 100644 --- a/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..8e41259aad2 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained.MS).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained.MS).sql index 74a0573a382..648262f3d00 100644 --- a/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..94d06f98e32 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..0246ba3d7a1 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS).sql index 7595b1a2bb2..0246ba3d7a1 100644 --- a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS).sql index 1251dc6dded..14674b6b0cf 100644 --- a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.Contained.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..028d9560614 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..b5a9fb1d6dd --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..14674b6b0cf --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..001af5273a3 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..7595b1a2bb2 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.MS).sql new file mode 100644 index 00000000000..1251dc6dded --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 03).sql b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 03).sql index dd9aed83848..ce2afa87cea 100644 --- a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 03).sql +++ b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 04).sql b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 04).sql index a8fa1ee29d4..be832c076ba 100644 --- a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 04).sql +++ b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 05).sql b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 05).sql index 5b5235726f0..5e0fc113378 100644 --- a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 05).sql +++ b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 06).sql b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 06).sql index 5ccab7b6b82..b4f49cb97e1 100644 --- a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 06).sql +++ b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 07).sql b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 07).sql index 0a2292d4cda..b5780ccc513 100644 --- a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 07).sql +++ b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 12).sql b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 12).sql index 034b134e7ae..285680fb554 100644 --- a/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 12).sql +++ b/SqlServer.Contained.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 diff --git a/SqlServer.Contained.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained.MS).sql index 44297e0e46a..ecff784b71a 100644 --- a/SqlServer.Contained.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained.MS).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.Contained.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained.MS).sql index 54ba4919c55..427b7e71513 100644 --- a/SqlServer.Contained.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained.MS).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.Contained.MS SqlServer.2019 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS).sql index 9e7afe1f081..7764fdd8f13 100644 --- a/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS).sql index 821d2be312d..e844f2eb2fb 100644 --- a/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS).sql index 2f32265a187..923339cf657 100644 --- a/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS).sql +++ b/SqlServer.Contained.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained).sql index 1a8a8dc3d83..51ad6147ac3 100644 --- a/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.Contained).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained).sql index 1a8a8dc3d83..51ad6147ac3 100644 --- a/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.Contained).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained).sql index fdc1dc04258..b5286b7ef9f 100644 --- a/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.Contained).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained,False).sql b/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained,False).sql index b6d82302777..2878d8e56aa 100644 --- a/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained,False).sql +++ b/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.Contained,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained).sql index c3501a6ffbe..d10fb1e1a4d 100644 --- a/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.Contained).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained).sql index f29ee8aa0a4..d8a736af5f0 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained).sql index 04ca6b693b8..ecacc49d41b 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained).sql index 45c8939f1ac..eb8b8bd120d 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained).sql index 64dd89bce70..d54ad63aa29 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained).sql index 898d2262033..e05836a3045 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained).sql index ce1f8d696b1..3113ac508ed 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained).sql index c702486ff4f..43b0cecea86 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained).sql index 90bcce8bc6f..534e33e028f 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained).sql index 315cbcc0b2d..15c54d0a967 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained).sql index 5d881d3a466..5f25b5217b3 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained).sql index 8bc2df976fd..db409eff180 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained).sql index d783752e0c6..d7f74901a18 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained).sql index 4aa40b86d49..1a3a5feea83 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained).sql index 3cb1b30b405..b5bfb57e2b1 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained).sql index 7b136755b26..dc514973759 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained).sql index efe4faeb5ba..b2dc1ab642d 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained).sql index 810daa1db00..428ac4c2cfe 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained).sql index 65b02857260..86edef4dc57 100644 --- a/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.Contained).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained).sql index b51e60f89bb..c7e645fa25e 100644 --- a/SqlServer.Contained/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.Contained).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,1).sql b/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,1).sql index 74e145cf891..b4b6a542179 100644 --- a/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,1).sql +++ b/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,2).sql b/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,2).sql index f6fffa0db67..dcb3853f306 100644 --- a/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,2).sql +++ b/SqlServer.Contained/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.Contained,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.Contained/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained).sql index 9dbb27395dd..3d2c3c79e1a 100644 --- a/SqlServer.Contained/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.Contained).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,14).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,14).sql index e14ae0b3db1..6281c9bbaae 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,14).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,15).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,15).sql index 7c95c222265..746ebe4904a 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,15).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.Contained,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,14).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,14).sql index 06dfcfa9b12..2a93c975394 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,14).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,15).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,15).sql index 018288fc060..c6c52c545e2 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,15).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.Contained,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,14).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,14).sql index c880f48b292..273d9152dd6 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,14).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,15).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,15).sql index d6eaf160686..bc4ffb169eb 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,15).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.Contained,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,14).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,14).sql index 6e20c60d13b..e4cfd80dcae 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,14).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,15).sql b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,15).sql index f06ce271659..29083373459 100644 --- a/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,15).sql +++ b/SqlServer.Contained/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.Contained,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained).sql index 3d7605b2531..71aa64f6e6b 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.Contained).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained).sql index 3d7605b2531..71aa64f6e6b 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.Contained).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained).sql index 3d7605b2531..71aa64f6e6b 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.Contained).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained).sql index 4faa461b873..2dd9b981c38 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.Contained).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained).sql index 4faa461b873..2dd9b981c38 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.Contained).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained).sql index 4faa461b873..2dd9b981c38 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.Contained).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained).sql index c051500dfc3..4336140434d 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.Contained).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained).sql index 8aa23f1d059..676cc7166a9 100644 --- a/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.Contained).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained).sql index 9ffaeac94c8..ef833f0a2f9 100644 --- a/SqlServer.Contained/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.Contained).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained).sql index 2cb4a498df0..0db4c7cac5b 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.Contained).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained).sql index 8d259c85e87..19f52c698c0 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.Contained).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained).sql index 87872ac26bd..4ce3274cb5c 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.Contained).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql index 36a40cc6076..59595b34682 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql index d7db8ed3467..d26026d48ca 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql index 06003096bd6..63879faeb8c 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql index 94fac59b0c2..135f3c710f5 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql index 8cb6a671f92..75ad7bfec05 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.Contained).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql index 352ac9c29ef..e315da4fa94 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.Contained).sql @@ -2,13 +2,13 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql index ee87502518b..3d2f381a7d6 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.Contained).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql index 6ed7416b9a4..66cd2e28f23 100644 --- a/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.Contained).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained).sql index 63f686d9218..de2cdad1bc6 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.Contained).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained).sql index c96c0936e42..05627b12ab2 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.Contained).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained).sql index b17ed827e7d..1a21559e3a5 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.Contained).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained).sql index 1a2c3f09f3e..cd033f8b15c 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.Contained).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained).sql index 1a2c3f09f3e..2793acac062 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.Contained).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained).sql index 1b23e636ff9..09a0a0d4d20 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.Contained).sql @@ -2,11 +2,11 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained).sql index 6e780c2773d..76de44afc71 100644 --- a/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.Contained).sql @@ -2,11 +2,18 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained).sql new file mode 100644 index 00000000000..ce76e444bdd --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.Contained).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained).sql index f7771f21610..f137a817637 100644 --- a/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.Contained).sql @@ -2,38 +2,28 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained).sql new file mode 100644 index 00000000000..2720f8467f3 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.Contained).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained).sql new file mode 100644 index 00000000000..03c93673afc --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.Contained).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained).sql index 75a3d3ebe9d..03c93673afc 100644 --- a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.Contained).sql @@ -2,17 +2,10 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained).sql index d5fa1951922..b21ffbc7b5a 100644 --- a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.Contained).sql @@ -2,14 +2,10 @@ -- SqlServer.Contained SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained).sql new file mode 100644 index 00000000000..13608184372 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.Contained).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained).sql new file mode 100644 index 00000000000..36ca30d68d4 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.Contained).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained).sql new file mode 100644 index 00000000000..b21ffbc7b5a --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.Contained).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained).sql new file mode 100644 index 00000000000..45d1354d6ca --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.Contained).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained).sql new file mode 100644 index 00000000000..75a3d3ebe9d --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.Contained).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained).sql new file mode 100644 index 00000000000..d5fa1951922 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.Contained).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.Contained SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 03).sql b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 03).sql index f2802ffb32a..a7b068697ce 100644 --- a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 03).sql +++ b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 04).sql b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 04).sql index 21830005295..e26152ac90c 100644 --- a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 04).sql +++ b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 05).sql b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 05).sql index 788ee81624a..d5a47415ffd 100644 --- a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 05).sql +++ b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 06).sql b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 06).sql index 71ba93f57f5..44d74d8ea4f 100644 --- a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 06).sql +++ b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 07).sql b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 07).sql index 008df5a7739..549bc3f16ed 100644 --- a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 07).sql +++ b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 12).sql b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 12).sql index 2fc7a00ad70..704f3dd1abb 100644 --- a/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 12).sql +++ b/SqlServer.Contained/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.Contained,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.Contained SqlServer.2019 diff --git a/SqlServer.Contained/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained).sql b/SqlServer.Contained/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained).sql index 9fb4c6d3cbc..79c6f4bc468 100644 --- a/SqlServer.Contained/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.Contained).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.Contained/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained).sql b/SqlServer.Contained/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained).sql index bc1253f359f..b9f261a5ecd 100644 --- a/SqlServer.Contained/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.Contained).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.Contained SqlServer.2019 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained).sql b/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained).sql index 9dcee30a5ea..a60facf1a22 100644 --- a/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.Contained).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained).sql b/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained).sql index 448618f53e9..d5c65db583c 100644 --- a/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.Contained).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained).sql b/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained).sql index b9ada8a4f3b..55ef9664d9e 100644 --- a/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained).sql +++ b/SqlServer.Contained/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.Contained).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind.MS).sql b/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind.MS).sql index bba3f492be4..379dabd5acc 100644 --- a/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind.MS).sql +++ b/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind.MS).sql @@ -15,15 +15,15 @@ AS [p].[UnitPrice] > 10 ) SELECT - [t1].[ProductName], - [t1].[CategoryName], - [t1].[UnitPrice] + [p_1].[ProductName], + [p_1].[CategoryName], + [p_1].[UnitPrice] FROM - [ProductAndCategoryNamesOverTenDollars] [t1] + [ProductAndCategoryNamesOverTenDollars] [p_1] ORDER BY - [t1].[CategoryName], - [t1].[UnitPrice], - [t1].[ProductName] + [p_1].[CategoryName], + [p_1].[UnitPrice], + [p_1].[ProductName] BeforeExecute -- SqlServer.Northwind.MS SqlServer.2019 diff --git a/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind.MS).sql b/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind.MS).sql index 7bca536a0f7..f4529809f8d 100644 --- a/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind.MS).sql +++ b/SqlServer.Northwind.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind.MS).sql @@ -33,13 +33,13 @@ AS SELECT [c_2].[CategoryName], [c_2].[NumberOfProducts], - [p_2].[ProductName], - [p_2].[UnitPrice] + [t1].[ProductName], + [t1].[UnitPrice] FROM - [ProductsOverTenDollars] [p_2] - INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [p_2].[CategoryID] + [ProductsOverTenDollars] [t1] + INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [t1].[CategoryID] ORDER BY - [p_2].[ProductName] + [t1].[ProductName] BeforeExecute -- SqlServer.Northwind.MS SqlServer.2019 diff --git a/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind).sql b/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind).sql index 5b8888295e0..78c5d2612fb 100644 --- a/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind).sql +++ b/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductAndCategoryNamesOverTenDollars2(SqlServer.Northwind).sql @@ -15,15 +15,15 @@ AS [p].[UnitPrice] > 10 ) SELECT - [t1].[ProductName], - [t1].[CategoryName], - [t1].[UnitPrice] + [p_1].[ProductName], + [p_1].[CategoryName], + [p_1].[UnitPrice] FROM - [ProductAndCategoryNamesOverTenDollars] [t1] + [ProductAndCategoryNamesOverTenDollars] [p_1] ORDER BY - [t1].[CategoryName], - [t1].[UnitPrice], - [t1].[ProductName] + [p_1].[CategoryName], + [p_1].[UnitPrice], + [p_1].[ProductName] BeforeExecute -- SqlServer.Northwind SqlServer.2019 diff --git a/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind).sql b/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind).sql index 241211dbcb5..ef24aab5474 100644 --- a/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind).sql +++ b/SqlServer.Northwind/Tests/Linq/CteTests/Tests.Linq.CteTests.ProductsOverTenDollars(SqlServer.Northwind).sql @@ -33,13 +33,13 @@ AS SELECT [c_2].[CategoryName], [c_2].[NumberOfProducts], - [p_2].[ProductName], - [p_2].[UnitPrice] + [t1].[ProductName], + [t1].[UnitPrice] FROM - [ProductsOverTenDollars] [p_2] - INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [p_2].[CategoryID] + [ProductsOverTenDollars] [t1] + INNER JOIN [CategoryAndNumberOfProducts] [c_2] ON [c_2].[CategoryID] = [t1].[CategoryID] ORDER BY - [p_2].[ProductName] + [t1].[ProductName] BeforeExecute -- SqlServer.Northwind SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.LinqService,False).sql b/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.LinqService,False).sql index 11fb52e30dd..17936f4d76b 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.LinqService,False).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.LinqService).sql index 99f0ee7798a..3296a3aba96 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.LinqService).sql index 4c277820810..1db439b8f3a 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.LinqService).sql index b7d077099b5..dc8ad9850c7 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.LinqService).sql index d6a289b29ea..1a6542241bd 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.LinqService).sql index 703ee7ae6d4..3a1ef94f684 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.LinqService).sql index d92ec5f1847..c43f9ab1dcc 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.LinqService).sql index 741c2543309..c9b30b73c52 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.LinqService).sql index 938b33a9fd2..4b32f827ec7 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.LinqService).sql index 60aedd77acc..1e873f44085 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.LinqService).sql index 8376ff986cf..6259e503f3f 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.LinqService).sql index 9950c4dfa0b..865432240a5 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.LinqService).sql index 4cf5ccbedd6..4be6fffb468 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.LinqService).sql index 24d507d819e..5f06aede084 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.LinqService).sql index f586b6a8e36..6621915b014 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.LinqService).sql index 434e934d999..becb71ef7af 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.LinqService).sql index 52a3828a90f..43b1d7483e6 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.LinqService).sql index 188e7519b56..7c99ea1ef8e 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.LinqService).sql index 627efc90d03..5f7301f9ca0 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.LinqService).sql index e1c9c6817e0..12d34de045e 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.LinqService).sql index 989a0fb7030..817a29eb318 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,1).sql b/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,1).sql index d1c17cd59c7..84da2d5b7ec 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,1).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,2).sql b/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,2).sql index 2c2c3fccc3d..018915ce4ba 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,2).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.LinqService).sql index 4540a2c877d..e59ab7fa7c6 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,14).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,14).sql index f4dd9b58047..6c9d2d03ea5 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,14).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,15).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,15).sql index 6372d235828..0673190a562 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,15).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,14).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,14).sql index 160bf92861d..4cbbe3b6114 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,14).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,15).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,15).sql index 7ed464c110e..64e09b98206 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,15).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,14).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,14).sql index 2c30374c238..be823f7cb10 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,14).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,15).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,15).sql index 46c4b5e5741..e100dae0082 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,15).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,14).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,14).sql index 660ae3eaa63..b0dadf031d9 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,14).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,15).sql b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,15).sql index 5079ee966b2..6c092106ff0 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,15).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.LinqService).sql index afafb01a65c..4e725d77f89 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.LinqService).sql index afafb01a65c..4e725d77f89 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.LinqService).sql index afafb01a65c..4e725d77f89 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.LinqService).sql index e537ed27e29..d25db707d07 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.LinqService).sql index e537ed27e29..d25db707d07 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.LinqService).sql index e537ed27e29..d25db707d07 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.LinqService).sql index bd209ce408c..a6fb0e1518c 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.LinqService).sql index e102dd62b61..a3d0cdd474c 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.LinqService).sql index 1843e1de855..870bb46b969 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.LinqService).sql index 589ae18414b..d58227846dd 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.LinqService).sql index 13cdd752b9b..e8560ad476b 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql index 331c30b6b98..bbe251f28fd 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql index 5480bc4bd39..0e8b982d004 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.SA SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql index 89ea1973e49..bd442188ff8 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql index 751601ed896..22808dac16c 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql index 9a4c4d7ed8a..8dec678f048 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql index 0c543a45bed..057ccb99b99 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.SA SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql index 155c1861b0b..a00dcb9ee42 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql index bb274951eae..b5c2ba59b7c 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.LinqService).sql index 253e44b8298..17e8d796460 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.LinqService).sql index b146ecf4ca8..07aaca9b4c7 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.LinqService).sql index 6335ccade0c..7f5d397f7ef 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.SA SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.LinqService).sql index cbe10db0f10..9830666a36b 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.LinqService).sql index cbe10db0f10..53eef528df3 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.SA SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.LinqService).sql index 2926517a37f..e0d2aea6e97 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.SA SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.LinqService).sql index b0ba9e453d9..1050be4d4ab 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.SA SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.SA.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..925ee4bc6cb --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..9b4c7c350cb --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..0b40a523c62 --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.LinqService).sql index 75fe47fa5e0..0b40a523c62 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.SA SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.LinqService).sql index cac820222a4..1c2cd8fe48b 100644 --- a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.SA SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..b2579b34af0 --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..98ce46862dc --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..1c2cd8fe48b --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..3ad158d8977 --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..75fe47fa5e0 --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.LinqService).sql new file mode 100644 index 00000000000..cac820222a4 --- /dev/null +++ b/SqlServer.SA.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.LinqService).sql index 89a1fab0a9f..12f8c1e2441 100644 --- a/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.LinqService).sql index 4d65f2e2444..6fe367a4843 100644 --- a/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.LinqService).sql b/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.LinqService).sql index 491d334dd06..cdb744a3b1c 100644 --- a/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.LinqService).sql +++ b/SqlServer.SA.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS.LinqService,False).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS.LinqService,False).sql index a8e599ed5a6..aca29b1be6e 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS.LinqService,False).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS.LinqService,False).sql @@ -108,16 +108,21 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS.LinqService).sql index b492f2b915c..616778a4d83 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS.LinqService).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS.LinqService).sql index 2f228eda244..c858eec28a0 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS.LinqService).sql index 904fb71f6f9..6cfbe4773b2 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS.LinqService).sql index ebb9dac471b..34d35a196df 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS.LinqService).sql index 3cf92f5a997..f20dcd291cd 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS.LinqService).sql index 9044a3fd206..c7f71b689b2 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS.LinqService).sql index 8408ac8ae5a..d9e59a34df2 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS.LinqService).sql index 0226645ea96..7789d37ddbe 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS.LinqService).sql index 63ca000901d..719b881e9d5 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS.LinqService).sql index 19685321b9f..216f3a3e4fc 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS.LinqService).sql index b407a34d8b4..57f3641aff0 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS.LinqService).sql index 8267777a03a..49002eb54dc 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS.LinqService).sql index b9b38a7968a..b8b40e28b47 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS.LinqService).sql index 7e325a958b9..7834200e5fb 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS.LinqService).sql index 5c765bee333..ec250c503a5 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS.LinqService).sql index 0cfca56ae0e..cb00b0f0c25 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS.LinqService).sql index 5a780dead21..5e335d09ee0 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS.LinqService).sql index 97dbeb16de4..e1021f21917 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS.LinqService).sql index fec81339f7b..4d721f2f723 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS.LinqService).sql @@ -487,7 +487,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -495,11 +495,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS.LinqService).sql index 52149895811..3106abccfd6 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS.LinqService).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,1).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,1).sql index 555643dcdf6..0c342cd0d04 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,1).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,2).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,2).sql index 43852a3ee86..11e413664d2 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,2).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS.LinqService,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS.LinqService).sql index 3a24a195bdc..d0cdf72cfc9 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS.LinqService).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,14).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,14).sql index bffd7ca29e4..707868b2ab8 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,14).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,15).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,15).sql index bebc3131500..92f9b4041c6 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,15).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,14).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,14).sql index 0851ca17a94..b888e5e485b 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,14).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,15).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,15).sql index 1acb8c564c9..380b7a8b5a0 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,15).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,14).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,14).sql index bde25175ac9..e06e1425116 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,14).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,15).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,15).sql index 263d17d7e72..8680b653882 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,15).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,14).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,14).sql index 1dec43a08d8..7ee6d8fffaf 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,14).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,14).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,15).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,15).sql index 6a4d29259f2..621bc1bde56 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,15).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS.LinqService,15).sql @@ -384,10 +384,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS.LinqService).sql index 22ddbdcc4cd..72512d6271c 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS.LinqService).sql index 22ddbdcc4cd..72512d6271c 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS.LinqService).sql index 22ddbdcc4cd..72512d6271c 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS.LinqService).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS.LinqService).sql index 1f299059b89..50741371513 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS.LinqService).sql index 1f299059b89..50741371513 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS.LinqService).sql index 1f299059b89..50741371513 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS.LinqService).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS.LinqService).sql index 4d41a6d1d4a..f55c73187fd 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS.LinqService).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS.LinqService).sql index 4c8e98572ad..4db01b1550f 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS.LinqService).sql @@ -65,10 +65,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -85,10 +85,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -111,7 +111,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 @@ -119,14 +119,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS.LinqService).sql index a372604985f..748feff165f 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS.LinqService).sql index 4ceecc062ca..a5d7448b78d 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS.LinqService).sql index a7b4e340a50..f14d1c6b8eb 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql index d58ba581af7..7196e2ae7e7 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql index b8d0b5fee1c..5e40c1ffa30 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql index f29454dece8..8add8d7d26a 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql index ac10f8319aa..4a513dcbe95 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql index e907f5fcbf1..565566b9941 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql index 7c54e6512e4..bc93807f866 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS.LinqService).sql @@ -2,13 +2,13 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql index 935f8506a28..6af7fa82dfa 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql index f1969077d31..67eeb543619 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS.LinqService).sql index 51ac47248d6..71e6fefc0bd 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -540,13 +540,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS.LinqService).sql index dbdd5489611..0b53538d68b 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS.LinqService).sql @@ -508,13 +508,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS.LinqService).sql index 118164188ad..aa2b1f4757f 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS.LinqService).sql index e34dadb0252..3dda2b05601 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS.LinqService).sql index e34dadb0252..4002c0e411a 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS.LinqService).sql index a84d997353c..94ffac08963 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS.LinqService).sql @@ -2,11 +2,11 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS.LinqService).sql index 0c71d15f601..cadab001a45 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS.LinqService).sql @@ -2,11 +2,18 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..f4df0a49378 --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,154 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 +DECLARE @Id Int -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Int -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Int -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Int -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..3839193a626 --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..ea1d816ca27 --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS.LinqService).sql index 3ddccc722d9..ea1d816ca27 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS.LinqService).sql @@ -2,17 +2,10 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS.LinqService).sql index 3e07d91d26b..8d597c23a92 100644 --- a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS.LinqService).sql @@ -2,14 +2,10 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..c722127e202 --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..ff723dc9e9c --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..8d597c23a92 --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..37986b06cbb --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..3ddccc722d9 --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.MS.LinqService).sql new file mode 100644 index 00000000000..3e07d91d26b --- /dev/null +++ b/SqlServer.SA.MS.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.MS.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS.LinqService).sql index 6fb299d0573..d30488f96d4 100644 --- a/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS.LinqService).sql index f807dfaba4e..e3e70e1edb2 100644 --- a/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS.LinqService).sql b/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS.LinqService).sql index fa1578a12b5..1a7081ea6ba 100644 --- a/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS.LinqService).sql +++ b/SqlServer.SA.MS.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS.LinqService).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA.MS).sql index c0f71bce542..83f28861525 100644 --- a/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA.MS).sql index c0f71bce542..83f28861525 100644 --- a/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA.MS).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA.MS).sql index 5481aa01c83..8caf05778c8 100644 --- a/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA.MS).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS,False).sql b/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS,False).sql index 306fef38cf6..3d64622df7d 100644 --- a/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS,False).sql +++ b/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA.MS,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS).sql index b492f2b915c..616778a4d83 100644 --- a/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA.MS).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS).sql index e306e6847ca..1fce4fdc16f 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS).sql index 43324f40b6d..6022a43db7d 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS).sql index ee57a260a79..d072ef3d8d9 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS).sql index 3a4f709e726..61428c3c52e 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS).sql index 8bcf28b5b0d..705499806db 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS).sql index dee60e2177e..175deeb2565 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS).sql index ac2aa88b227..eb202fbe7f7 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS).sql index cda73976143..fb22a704477 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS).sql index 4de1b27d0f4..40fb5fe188a 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS).sql index 5aab641e8f7..1988ae01034 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS).sql index d9bf5717555..28e77ec63f0 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS).sql index 297a8319e74..49ac20bcec1 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS).sql index f44618004c6..c685c743070 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS).sql index c7af2c0449d..60044a2291b 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS).sql index 3b554ee9030..22db16c1d98 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS).sql index a65bb936ccc..4b3e34abf09 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS).sql index 235f6f5f355..ecd4bb2969e 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS).sql index a2d66046689..1a313ac0c76 100644 --- a/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA.MS).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS).sql index 52149895811..3106abccfd6 100644 --- a/SqlServer.SA.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA.MS).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,1).sql b/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,1).sql index 555643dcdf6..0c342cd0d04 100644 --- a/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,1).sql +++ b/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,2).sql b/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,2).sql index 43852a3ee86..11e413664d2 100644 --- a/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,2).sql +++ b/SqlServer.SA.MS/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA.MS,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS).sql index 3a24a195bdc..d0cdf72cfc9 100644 --- a/SqlServer.SA.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA.MS).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,14).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,14).sql index 913cdfeb84c..bb4cae4d0ce 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,14).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,15).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,15).sql index d258eec8451..30b335aec8c 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,15).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,14).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,14).sql index 646eaacebf0..c37bb03ab9d 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,14).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,15).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,15).sql index b70482e6140..7b46163679c 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,15).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,14).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,14).sql index b053aaa5cf1..ed0026d1cb4 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,14).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,15).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,15).sql index d2cc5d84015..99aaf8dc5ea 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,15).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,14).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,14).sql index 23f4cf6a7aa..31268ab5ae0 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,14).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,15).sql b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,15).sql index 879ce46260c..1ffbfaa65e7 100644 --- a/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,15).sql +++ b/SqlServer.SA.MS/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA.MS,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS).sql index 22ddbdcc4cd..72512d6271c 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS).sql index 22ddbdcc4cd..72512d6271c 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS).sql index 22ddbdcc4cd..72512d6271c 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA.MS).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS).sql index 1f299059b89..50741371513 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS).sql index 1f299059b89..50741371513 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS).sql index 1f299059b89..50741371513 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA.MS).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS).sql index 4d41a6d1d4a..f55c73187fd 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA.MS).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS).sql index 25e407ec914..58f9e22c9d2 100644 --- a/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA.MS).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA.MS).sql index f57eb79cee5..36bbc428778 100644 --- a/SqlServer.SA.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA.MS).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS).sql index a372604985f..748feff165f 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA.MS).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS).sql index 4ceecc062ca..a5d7448b78d 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS).sql index a7b4e340a50..f14d1c6b8eb 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql index d58ba581af7..7196e2ae7e7 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql index b8d0b5fee1c..5e40c1ffa30 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql index f29454dece8..8add8d7d26a 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql index ac10f8319aa..4a513dcbe95 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql index e907f5fcbf1..565566b9941 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA.MS).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql index 7c54e6512e4..bc93807f866 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA.MS).sql @@ -2,13 +2,13 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql index 935f8506a28..6af7fa82dfa 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA.MS).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql index f1969077d31..67eeb543619 100644 --- a/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA.MS).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS).sql index caccbe49e0c..bc21bb8f004 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS).sql index 912ba573d33..5e70a09d64a 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA.MS).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS).sql index 118164188ad..aa2b1f4757f 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS).sql index e34dadb0252..3dda2b05601 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA.MS).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS).sql index e34dadb0252..4002c0e411a 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS).sql index a84d997353c..94ffac08963 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA.MS).sql @@ -2,11 +2,11 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS).sql index 0c71d15f601..cadab001a45 100644 --- a/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA.MS).sql @@ -2,11 +2,18 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..34d9aab9ba4 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA.MS).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA.MS).sql index 6eecb0136cc..6fc5243b151 100644 --- a/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA.MS).sql @@ -2,38 +2,28 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..3839193a626 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..ea1d816ca27 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS).sql index 3ddccc722d9..ea1d816ca27 100644 --- a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA.MS).sql @@ -2,17 +2,10 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS).sql index 3e07d91d26b..8d597c23a92 100644 --- a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA.MS).sql @@ -2,14 +2,10 @@ -- SqlServer.SA.MS SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..c722127e202 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..ff723dc9e9c --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..8d597c23a92 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA.MS).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..37986b06cbb --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..3ddccc722d9 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA.MS).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.MS).sql new file mode 100644 index 00000000000..3e07d91d26b --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA.MS).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 03).sql b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 03).sql index dbb47ccfbc3..989cd1bf975 100644 --- a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 03).sql +++ b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 04).sql b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 04).sql index a8e8f92254e..b8796385a06 100644 --- a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 04).sql +++ b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 05).sql b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 05).sql index dd572d7cc8f..5531ea1ffd2 100644 --- a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 05).sql +++ b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 06).sql b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 06).sql index 545adc76c78..805d4e17f63 100644 --- a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 06).sql +++ b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 07).sql b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 07).sql index ebccf5016a1..80f893668ab 100644 --- a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 07).sql +++ b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 12).sql b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 12).sql index 52f6cb3bb19..e2779e71818 100644 --- a/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 12).sql +++ b/SqlServer.SA.MS/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA.MS,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA.MS SqlServer.2019 diff --git a/SqlServer.SA.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA.MS).sql index bcbaa1e03e3..a4a3a663f01 100644 --- a/SqlServer.SA.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA.MS).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.SA.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA.MS).sql index 3941d4d8c09..0592a262e48 100644 --- a/SqlServer.SA.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA.MS).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.SA.MS SqlServer.2019 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS).sql index 6fb299d0573..d30488f96d4 100644 --- a/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS).sql index f807dfaba4e..e3e70e1edb2 100644 --- a/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS).sql index fa1578a12b5..1a7081ea6ba 100644 --- a/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS).sql +++ b/SqlServer.SA.MS/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA.MS).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA).sql index 2f00eabf60c..a15e07f3ab9 100644 --- a/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate1(SqlServer.SA).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA).sql index 2f00eabf60c..a15e07f3ab9 100644 --- a/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate2(SqlServer.SA).sql @@ -4,22 +4,22 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA).sql index f5b16f285a2..5b85406e082 100644 --- a/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/AnalyticTests/Tests.Linq.AnalyticTests.WindowFunctionWithAggregate3(SqlServer.SA).sql @@ -4,20 +4,20 @@ DECLARE @take Int -- Int32 SET @take = 100 SELECT TOP (@take) - [g_2].[ParentID], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[key_1], + [t1].[COUNT_1], + [t1].[window_1] FROM ( SELECT - [g_1].[ParentID], + [g_1].[ParentID] as [key_1], COUNT(*) as [COUNT_1], - COUNT(*) OVER() as [c1] + COUNT(*) OVER() as [window_1] FROM [Child] [g_1] GROUP BY [g_1].[ParentID] - ) [g_2] + ) [t1] ORDER BY - [g_2].[ParentID] DESC + [t1].[key_1] DESC diff --git a/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA,False).sql b/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA,False).sql index e1df600d9bf..a9392404768 100644 --- a/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA,False).sql +++ b/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.Issue4167(SqlServer.SA,False).sql @@ -35,16 +35,21 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] FROM - [Issue4167Table] [g_1] -WHERE - [g_1].[Value] = N'000001' -GROUP BY - [g_1].[Value], - [g_1].[EnumValue] + ( + SELECT + IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) as [EnumValue] + FROM + [Issue4167Table] [g_1] + WHERE + [g_1].[Value] = N'000001' + GROUP BY + [g_1].[Value], + [g_1].[EnumValue] + ) [t1] ORDER BY - IIF([g_1].[EnumValue] IS NOT NULL, [g_1].[EnumValue], 0) + [t1].[EnumValue] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA).sql index 99f0ee7798a..3296a3aba96 100644 --- a/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/CteTests/Tests.Linq.CteTests.TestInsert(SqlServer.SA).sql @@ -68,10 +68,10 @@ SELECT [c4].[ChildID], [c4].[ParentID] FROM - [Child] [p] - INNER JOIN [Child] [c4] ON [c4].[ParentID] = [p].[ParentID] + [Child] [c_1] + INNER JOIN [Child] [c4] ON [c4].[ParentID] = [c_1].[ParentID] WHERE - [p].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 + [c_1].[ParentID] > 1 AND [c4].[ParentID] % 2 = 0 ORDER BY [c4].[ChildID], [c4].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA).sql index 1877ca0db1d..51dd3842432 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddDaysTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(day, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA).sql index 0d881b11858..b2790880a2d 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddHoursTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(hour, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA).sql index 7a11a80bf04..3177bad01af 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMillisecondsTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(millisecond, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA).sql index bee058771e9..44a36aeb832 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMinutesTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(minute, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA).sql index 7707d448b80..19a2e0a229d 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddMonthsTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(month, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA).sql index db2619f7843..dc46cc02a83 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddSecondsTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(second, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA).sql index 707f9176f2d..58861723aa1 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByAddYearsTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[c1], + [t1].[c1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DateAdd(year, -1, [x].[TransactionDate]) as [c1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[c1] + [t1].[c1] ORDER BY - [x_1].[c1] + [t1].[c1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA).sql index 3da6c1c52f2..b3c65d1dec0 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDateTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Date_1], + [t1].[Date_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Date) as [Date_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Date_1] + [t1].[Date_1] ORDER BY - [x_1].[Date_1] + [t1].[Date_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA).sql index 6f71a3e9475..9c5f1226dd4 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfWeekTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[DayOfWeek], + [t1].[DayOfWeek], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(weekday, [x].[TransactionDate]) - 1 as [DayOfWeek] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] ORDER BY - [x_1].[DayOfWeek] + [t1].[DayOfWeek] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA).sql index 9053bfcd242..549c6f78265 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayOfYearTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[DayOfYear], + [t1].[DayOfYear], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(dayofyear, [x].[TransactionDate]) as [DayOfYear] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[DayOfYear] + [t1].[DayOfYear] ORDER BY - [x_1].[DayOfYear] + [t1].[DayOfYear] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA).sql index ff45c199ca8..68680e5420a 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByDayTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Day_1], + [t1].[Day_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(day, [x].[TransactionDate]) as [Day_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Day_1] + [t1].[Day_1] ORDER BY - [x_1].[Day_1] + [t1].[Day_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA).sql index 763a3282fc2..9aa2bf17947 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByHourTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Hour_1], + [t1].[Hour_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(hour, [x].[TransactionDate]) as [Hour_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Hour_1] + [t1].[Hour_1] ORDER BY - [x_1].[Hour_1] + [t1].[Hour_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA).sql index b677e16f9ae..cee74510f1d 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMillisecondTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Millisecond], + [t1].[Millisecond], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(millisecond, [x].[TransactionDate]) as [Millisecond] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Millisecond] + [t1].[Millisecond] ORDER BY - [x_1].[Millisecond] + [t1].[Millisecond] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA).sql index d4b892e7fe0..75d73cd7dde 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMinuteTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Minute_1], + [t1].[Minute_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(minute, [x].[TransactionDate]) as [Minute_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Minute_1] + [t1].[Minute_1] ORDER BY - [x_1].[Minute_1] + [t1].[Minute_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA).sql index e5a11f5bfbb..bdc19b8d44a 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByMonthTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Month_1], + [t1].[Month_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(month, [x].[TransactionDate]) as [Month_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Month_1] + [t1].[Month_1] ORDER BY - [x_1].[Month_1] + [t1].[Month_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA).sql index 485f8064c07..cd4c7a44c26 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetBySecondTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Second_1], + [t1].[Second_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(second, [x].[TransactionDate]) as [Second_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Second_1] + [t1].[Second_1] ORDER BY - [x_1].[Second_1] + [t1].[Second_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA).sql index b31e02011c5..9197025e9de 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByTimeOfDayTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[TimeOfDay], + [t1].[TimeOfDay], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM CAST([x].[TransactionDate] AS Time) as [TimeOfDay] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] ORDER BY - [x_1].[TimeOfDay] + [t1].[TimeOfDay] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA).sql index 473ba83ae60..0267675b741 100644 --- a/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/DateTimeOffsetTests/Tests.Linq.DateTimeOffsetTests.GroupByDateTimeOffsetByYearTest(SqlServer.SA).sql @@ -55,7 +55,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [x_1].[Year_1], + [t1].[Year_1], COUNT(*) FROM ( @@ -63,11 +63,11 @@ FROM DatePart(year, [x].[TransactionDate]) as [Year_1] FROM [Transactions] [x] - ) [x_1] + ) [t1] GROUP BY - [x_1].[Year_1] + [t1].[Year_1] ORDER BY - [x_1].[Year_1] + [t1].[Year_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA).sql index 989a0fb7030..817a29eb318 100644 --- a/SqlServer.SA/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(SqlServer.SA).sql @@ -13,8 +13,8 @@ FROM FROM ( SELECT DISTINCT - [a_Children].[ParentID], - [a_Children].[ChildID] + [a_Children].[ChildID], + [a_Children].[ParentID] FROM [Child] [a_Children] WHERE diff --git a/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,1).sql b/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,1).sql index d1c17cd59c7..84da2d5b7ec 100644 --- a/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,1).sql +++ b/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,1).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,2).sql b/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,2).sql index 2c2c3fccc3d..018915ce4ba 100644 --- a/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,2).sql +++ b/SqlServer.SA/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(SqlServer.SA,2).sql @@ -9,10 +9,10 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN (VALUES (N'Janet',@ID), (N'Doe',@ID_1) - ) [n]([FirstName], [PersonID]) ON [p].[PersonID] = [n].[PersonID] + ) [n]([FirstName], [PersonID]) ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/SqlServer.SA/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA).sql index 4540a2c877d..e59ab7fa7c6 100644 --- a/SqlServer.SA/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(SqlServer.SA).sql @@ -20,8 +20,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + N' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,14).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,14).sql index 073fcb1a062..49d5cd1d1f5 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,14).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,15).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,15).sql index 7569122f977..b4cd06913cf 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,15).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(SqlServer.SA,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,14).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,14).sql index 538af857b01..b8cd3e1f4cc 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,14).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,15).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,15).sql index 21feff7686e..38f24f05e1c 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,15).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(SqlServer.SA,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,14).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,14).sql index 8b9cf106932..6570d1b94c4 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,14).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,15).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,15).sql index d7ee0efc2ec..8a86856bdb0 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,15).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(SqlServer.SA,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,14).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,14).sql index bb1aacdeff4..e9dcd47bf57 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,14).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,14).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,15).sql b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,15).sql index 4b5710680df..cd293c33233 100644 --- a/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,15).sql +++ b/SqlServer.SA/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(SqlServer.SA,15).sql @@ -54,10 +54,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA).sql index afafb01a65c..4e725d77f89 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsAggregate(SqlServer.SA).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA).sql index afafb01a65c..4e725d77f89 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsExpression(SqlServer.SA).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA).sql index afafb01a65c..4e725d77f89 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Having_AsWindow(SqlServer.SA).sql @@ -4,17 +4,17 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[count_1], + [t1].[percents] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [g_1].[ChildID], [a_Parent].[ParentID] as [group_1], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] @@ -23,7 +23,7 @@ FROM [a_Parent].[ParentID] HAVING [a_Parent].[ParentID] = @groupId - ) [g_2] + ) [t1] ORDER BY - [g_2].[COUNT_1] DESC + [t1].[count_1] DESC diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA).sql index e537ed27e29..d25db707d07 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsAggregate(SqlServer.SA).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA).sql index e537ed27e29..d25db707d07 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsExpression(SqlServer.SA).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA).sql index e537ed27e29..d25db707d07 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.CustomAggregate_Where_AsWindow(SqlServer.SA).sql @@ -4,26 +4,26 @@ DECLARE @groupId Int -- Int32 SET @groupId = 2 SELECT - [g_2].[ChildID], - [g_2].[group_1], - [g_2].[COUNT_1], - [g_2].[c1] + [t1].[ChildID], + [t1].[group_1], + [t1].[COUNT_1], + [t1].[percents] FROM ( SELECT [a_Parent].[ParentID] as [group_1], COUNT(*) as [COUNT_1], [g_1].[ChildID], - (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [c1] + (COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER()) as [percents] FROM [Child] [g_1] LEFT JOIN [Parent] [a_Parent] ON [g_1].[ParentID] = [a_Parent].[ParentID] GROUP BY [g_1].[ChildID], [a_Parent].[ParentID] - ) [g_2] + ) [t1] WHERE - [g_2].[group_1] = @groupId + [t1].[group_1] = @groupId ORDER BY - [g_2].[COUNT_1] DESC + [t1].[COUNT_1] DESC diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA).sql index bd209ce408c..a6fb0e1518c 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithToList(SqlServer.SA).sql @@ -81,19 +81,19 @@ SET @tz = N'UTC' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -114,7 +114,7 @@ FROM [t2].[group_1] IS NULL ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 @@ -126,19 +126,19 @@ SET @key = 'bc7b663d-0fde-4327-8f92-5d8cc3a11d11' SELECT [t3].[Id], [t3].[group_1], - [t3].[COUNT_1], - [t3].[c1], + [t3].[count_1], + [t3].[percents], [t3].[hours], [t3].[minutes] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [count_1], [t2].[Id], [t2].[group_1], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t2].[hours], - [t2].[minutes], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1] + [t2].[minutes] FROM ( SELECT @@ -159,7 +159,7 @@ FROM [t2].[group_1] = @key ) [t3] ORDER BY - [t3].[COUNT_1] DESC + [t3].[count_1] DESC BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA).sql index fd475477e12..98270ca2346 100644 --- a/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/GroupByTests/Tests.Linq.GroupByTests.Issue_WithoutToList(SqlServer.SA).sql @@ -67,10 +67,10 @@ SET @tz = N'UTC' SELECT [m_1].[Id], - [d].[Id], - [d].[group_1], - [d].[COUNT_1], - [d].[c1], + [d].[id], + [d].[reference], + [d].[count_1], + [d].[percents], [d].[hours], [d].[minutes] FROM @@ -87,10 +87,10 @@ FROM ) [m_1] CROSS APPLY ( SELECT - COUNT(*) as [COUNT_1], - [t3].[Id], - [t3].[group_1], - COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [c1], + COUNT(*) as [count_1], + [t3].[Id] as [id], + [t3].[group_1] as [reference], + COUNT_BIG(*) * 100E0 / SUM(COUNT_BIG(*)) OVER() as [percents], [t3].[hours], [t3].[minutes] FROM @@ -113,7 +113,7 @@ FROM ([t3].[group_1] = [m_1].[Id] OR [t3].[group_1] IS NULL AND [m_1].[Id] IS NULL) ) [d] ORDER BY - [d].[COUNT_1] DESC + [d].[count_1] DESC BeforeExecute DisposeTransaction @@ -123,14 +123,14 @@ BeforeExecute SELECT [a_Reference].[Id] FROM - [TestAggregateTable] [t1] - LEFT JOIN [TestAggregateTable] [a_Reference] ON [t1].[ReferenceId] = [a_Reference].[Id] + [TestAggregateTable] [group_1] + LEFT JOIN [TestAggregateTable] [a_Reference] ON [group_1].[ReferenceId] = [a_Reference].[Id] GROUP BY [a_Reference].[Id], - [t1].[ReferenceId], + [group_1].[ReferenceId], [a_Reference].[Id] ORDER BY - [t1].[ReferenceId] + [group_1].[ReferenceId] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA).sql index f58eeda1640..9f2b918e0a9 100644 --- a/SqlServer.SA/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/IdlTests/Tests.Linq.IdlTests.ConcatJoinOrderByTest(SqlServer.SA).sql @@ -3,7 +3,7 @@ SELECT [person_1].[PersonID], - [y_1].[PersonID] + [t1].[PersonID] FROM ( SELECT @@ -19,8 +19,8 @@ FROM [Patient] [pat] WHERE [pat].[Diagnosis] = N'b' - ) [y_1] - INNER JOIN [Person] [person_1] ON [y_1].[PersonID] = [person_1].[PersonID] + ) [t1] + INNER JOIN [Person] [person_1] ON [t1].[PersonID] = [person_1].[PersonID] ORDER BY [person_1].[PersonID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA).sql index 1843e1de855..870bb46b969 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(SqlServer.SA).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA).sql index 589ae18414b..d58227846dd 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFilters(SqlServer.SA).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [right_2] ON [right_2].[ParentID] = [left_1].[ParentID] + ) [right_2] ON [right_2].[ParentID] = [t1].[ParentID] ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA).sql index 13cdd752b9b..e8560ad476b 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithBothFiltersAlternative(SqlServer.SA).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_2].[left_1], + [t2].[left_1], [t1].[ParentID] FROM ( @@ -16,7 +16,7 @@ FROM [Parent] [left_1] WHERE [left_1].[ParentID] <> @id1 - ) [left_2] + ) [t2] FULL JOIN ( SELECT [right_1].[ParentID] @@ -24,7 +24,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id2 - ) [t1] ON [t1].[ParentID] = [left_2].[left_1] + ) [t1] ON [t1].[ParentID] = [t2].[left_1] ORDER BY - [left_2].[left_1] + [t2].[left_1] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql index 331c30b6b98..bbe251f28fd 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql index 5480bc4bd39..0e8b982d004 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql @@ -2,13 +2,13 @@ -- SqlServer.SA SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql index 89ea1973e49..bd442188ff8 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] FULL JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql index 751601ed896..22808dac16c 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlFullJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] FULL JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql index 9a4c4d7ed8a..8dec678f048 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(SqlServer.SA).sql @@ -6,7 +6,7 @@ DECLARE @id2 Int -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql index 0c543a45bed..057ccb99b99 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(SqlServer.SA).sql @@ -2,13 +2,13 @@ -- SqlServer.SA SqlServer.2019 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql index 155c1861b0b..a00dcb9ee42 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(SqlServer.SA).sql @@ -4,7 +4,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql index bb274951eae..b5c2ba59b7c 100644 --- a/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(SqlServer.SA).sql @@ -6,7 +6,7 @@ DECLARE @id1 Int -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA).sql index 435305823ad..a2095da36fb 100644 --- a/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(SqlServer.SA).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute @@ -102,13 +102,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA).sql index e6ec1102306..0fbbb562ee9 100644 --- a/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(SqlServer.SA).sql @@ -70,13 +70,13 @@ DECLARE @take Int -- Int32 SET @take = 3 SELECT - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) OFFSET @skip ROWS FETCH NEXT @take ROWS ONLY BeforeExecute diff --git a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA).sql index 6335ccade0c..7f5d397f7ef 100644 --- a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(SqlServer.SA).sql @@ -2,11 +2,11 @@ -- SqlServer.SA SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA).sql index cbe10db0f10..9830666a36b 100644 --- a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(SqlServer.SA).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA).sql index cbe10db0f10..53eef528df3 100644 --- a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(SqlServer.SA).sql @@ -2,11 +2,11 @@ -- SqlServer.SA SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA).sql index 2926517a37f..e0d2aea6e97 100644 --- a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(SqlServer.SA).sql @@ -2,11 +2,11 @@ -- SqlServer.SA SqlServer.2019 SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA).sql index b0ba9e453d9..1050be4d4ab 100644 --- a/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(SqlServer.SA).sql @@ -2,11 +2,18 @@ -- SqlServer.SA SqlServer.2019 SELECT - [t1].[PersonID], - [t1].[LastName], - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + IIF([t1].[PersonID] IN (1, 3), 1, 0) as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - IIF([t1].[PersonID] IN (1, 3), 1, 0) + [t2].[flag] diff --git a/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA).sql new file mode 100644 index 00000000000..64ec5866a91 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(SqlServer.SA).sql @@ -0,0 +1,66 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +IF (OBJECT_ID(N'[CoalesceNullableFields]', N'U') IS NULL) + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +(1,10,NULL,NULL), +(2,NULL,20,NULL), +(3,NULL,NULL,30), +(4,NULL,NULL,NULL) + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +DROP TABLE IF EXISTS [CoalesceNullableFields] + diff --git a/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA).sql index 3c3450fe246..067099655c0 100644 --- a/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/SelectTests/Tests.Linq.SelectTests.OuterApplyTest(SqlServer.SA).sql @@ -2,38 +2,28 @@ -- SqlServer.SA SqlServer.2019 SELECT - [t6].[ParentID_6], - [t6].[Value1], [t6].[ParentID], + [t6].[Value1], + [t6].[ParentID_1], [t6].[ChildID], [t6].[Any_1], [t6].[ChildID_1], - [t6].[ParentID_1], - [t6].[ChildID_2], [t6].[ParentID_2], - [t6].[ChildID_3], + [t6].[ChildID_2], [t6].[ParentID_3], - [t6].[ChildID_4], + [t6].[ChildID_3], [t6].[ParentID_4], + [t6].[ChildID_4], + [t6].[ParentID_5], [t6].[ChildID_5], - [t6].[ParentID_5] + [t6].[ParentID_6] FROM ( SELECT DISTINCT - [c1_1].[ParentID], - [c1_1].[ChildID], - [t1].[ChildID] as [ChildID_1], - [t1].[ParentID] as [ParentID_1], - [t2].[ChildID] as [ChildID_2], - [t2].[ParentID] as [ParentID_2], - [t3].[ChildID] as [ChildID_3], - [t3].[ParentID] as [ParentID_3], - [t4].[ChildID] as [ChildID_4], - [t4].[ParentID] as [ParentID_4], - [t5].[ChildID] as [ChildID_5], - [t5].[ParentID] as [ParentID_5], - [p].[ParentID] as [ParentID_6], + [p].[ParentID], [p].[Value1], + [c1_1].[ParentID] as [ParentID_1], + [c1_1].[ChildID], IIF(EXISTS( SELECT * @@ -41,7 +31,17 @@ FROM [Child] [c_6] WHERE [c_6].[ChildID] > 2 - ), 1, 0) as [Any_1] + ), 1, 0) as [Any_1], + [t1].[ChildID] as [ChildID_1], + [t1].[ParentID] as [ParentID_2], + [t2].[ChildID] as [ChildID_2], + [t2].[ParentID] as [ParentID_3], + [t3].[ChildID] as [ChildID_3], + [t3].[ParentID] as [ParentID_4], + [t4].[ChildID] as [ChildID_4], + [t4].[ParentID] as [ParentID_5], + [t5].[ChildID] as [ChildID_5], + [t5].[ParentID] as [ParentID_6] FROM [Parent] [p] OUTER APPLY ( @@ -100,5 +100,5 @@ FROM ) [t5] ) [t6] ORDER BY - [t6].[ParentID_6] + [t6].[ParentID] diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA).sql new file mode 100644 index 00000000000..9b4c7c350cb --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(SqlServer.SA).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], N'None') = N'None' AND + [p].[FirstName] = N'John' + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA).sql new file mode 100644 index 00000000000..0b40a523c62 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(SqlServer.SA).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA).sql index 75fe47fa5e0..0b40a523c62 100644 --- a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(SqlServer.SA).sql @@ -2,17 +2,10 @@ -- SqlServer.SA SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA).sql index cac820222a4..1c2cd8fe48b 100644 --- a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(SqlServer.SA).sql @@ -2,14 +2,10 @@ -- SqlServer.SA SqlServer.2019 SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA).sql new file mode 100644 index 00000000000..b2579b34af0 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(SqlServer.SA).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA).sql new file mode 100644 index 00000000000..98ce46862dc --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(SqlServer.SA).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA).sql new file mode 100644 index 00000000000..1c2cd8fe48b --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(SqlServer.SA).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA).sql new file mode 100644 index 00000000000..3ad158d8977 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(SqlServer.SA).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA).sql new file mode 100644 index 00000000000..75fe47fa5e0 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(SqlServer.SA).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA).sql new file mode 100644 index 00000000000..cac820222a4 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(SqlServer.SA).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- SqlServer.SA SqlServer.2019 + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 03).sql b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 03).sql index 6826c001bfb..a8b686e7e78 100644 --- a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 03).sql +++ b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 03).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[SUM_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - SUM([it].[YearsExperience]) as [SUM_1], + SUM([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[SUM_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 04).sql b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 04).sql index f086cfee8b0..4ad317f33ec 100644 --- a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 04).sql +++ b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 04).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MIN_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MIN([it].[YearsExperience]) as [MIN_1], + MIN([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MIN_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 05).sql b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 05).sql index b6a5edaf37e..a9206f7d230 100644 --- a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 05).sql +++ b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 05).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[MAX_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - MAX([it].[YearsExperience]) as [MAX_1], + MAX([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[MAX_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 06).sql b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 06).sql index 3c76df657ca..10eb3b69549 100644 --- a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 06).sql +++ b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 06).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[AVG_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - AVG([it].[YearsExperience]) as [AVG_1], + AVG([it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[AVG_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 07).sql b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 07).sql index c31e499aed1..f61d6a268de 100644 --- a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 07).sql +++ b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 07).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(DISTINCT [it].[YearsExperience]) as [COUNT_1], + COUNT(DISTINCT [it].[YearsExperience]) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 12).sql b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 12).sql index 911d724eeb3..5d425da4e60 100644 --- a/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 12).sql +++ b/SqlServer.SA/Tests/OData/Microsoft/MicrosoftODataTests/Tests.OData.Microsoft.MicrosoftODataTests.SelectViaOData(SqlServer.SA,Query 12).sql @@ -33,22 +33,22 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [it_1].[Name], - [it_1].[Value_1], - [it_1].[COUNT_1] + [t1].[Name], + [t1].[Value_2], + [t1].[Value_1] FROM ( SELECT - COUNT(*) as [COUNT_1], + COUNT(*) as [Value_1], N'Title' as [Name], - [it].[Title] as [Value_1] + [it].[Title] as [Value_2] FROM [odata_person] [it] GROUP BY [it].[Title] - ) [it_1] + ) [t1] ORDER BY - [it_1].[COUNT_1] + [t1].[Value_1] BeforeExecute -- SqlServer.SA SqlServer.2019 diff --git a/SqlServer.SA/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA).sql b/SqlServer.SA/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA).sql index 26b5680bded..5d6153ff483 100644 --- a/SqlServer.SA/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/UserTests/Issue1700Tests/Tests.UserTests.Issue1700Tests.TestOuterApplySubFunction(SqlServer.SA).sql @@ -82,21 +82,21 @@ FROM SELECT TOP (1) [t1].[AppSubTypeId], [t1].[Description], - [t1].[MAX_1] as [MaxSubtypeCreatedDate], - [t1].[MAX_2] as [MaxTypeCreatedDate], - [t1].[MAX_3] as [MaxTypeId], - [t1].[CountExt] as [CountDistinctTypeId], - [t1].[CountExt_1] as [CountDistinctSubTypeId] + [t1].[MaxSubtypeCreatedDate], + [t1].[MaxTypeCreatedDate], + [t1].[MaxTypeId], + [t1].[CountDistinctTypeId], + [t1].[CountDistinctSubTypeId] FROM ( SELECT - COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountExt], - MAX([grpby_1].[subtypeCreatedDate]) as [MAX_1], - MAX([grpby_1].[typeCreatedDate]) as [MAX_2], - MAX([grpby_1].[AppTypeId]) as [MAX_3], + COUNT(DISTINCT [grpby_1].[AppTypeId]) as [CountDistinctTypeId], + MAX([grpby_1].[subtypeCreatedDate]) as [MaxSubtypeCreatedDate], + MAX([grpby_1].[typeCreatedDate]) as [MaxTypeCreatedDate], + MAX([grpby_1].[AppTypeId]) as [MaxTypeId], [grpby_1].[AppSubTypeId], [grpby_1].[Description], - COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountExt_1] + COUNT(DISTINCT [grpby_1].[AppSubTypeId]) as [CountDistinctSubTypeId] FROM ( SELECT @@ -118,10 +118,10 @@ FROM [grpby_1].[AppSubTypeId] ) [t1] ORDER BY - [t1].[CountExt] DESC, - [t1].[MAX_1] DESC, - [t1].[MAX_2] DESC, - [t1].[MAX_3] DESC + [t1].[CountDistinctTypeId] DESC, + [t1].[MaxSubtypeCreatedDate] DESC, + [t1].[MaxTypeCreatedDate] DESC, + [t1].[MaxTypeId] DESC ) [t2] WHERE [i].[GroupId] = @groupId diff --git a/SqlServer.SA/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA).sql b/SqlServer.SA/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA).sql index 96ab91c2044..6a67b01492c 100644 --- a/SqlServer.SA/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/UserTests/Issue3259Tests/Tests.UserTests.Issue3259Tests.SubqueryAggregation(SqlServer.SA).sql @@ -126,7 +126,7 @@ BeforeExecute -- SqlServer.SA SqlServer.2019 SELECT - [t9].[SUM_1], + [t9].[WithParentReference], [t9].[WithParentReferenceCustom1], [t9].[WithParentReferenceCustom2], [t9].[WithoutParentReference] @@ -156,7 +156,7 @@ FROM [a_Employee].[EmployeeId] = [e].[EmployeeId] ) [d] ON 1=1 ) [t2] - ) as [SUM_1], + ) as [WithParentReference], ( SELECT Sum([t4].[c1]) @@ -234,7 +234,7 @@ FROM INNER JOIN [Employee] [a_Employee] ON [tracking].[EmployeeId] = [a_Employee].[EmployeeId] ) [t9] ORDER BY - Coalesce([t9].[SUM_1], 0), + Coalesce([t9].[WithParentReference], 0), Coalesce([t9].[WithParentReferenceCustom1], 0), Coalesce([t9].[WithParentReferenceCustom2], 0), Coalesce([t9].[WithoutParentReference], 0) DESC diff --git a/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA).sql b/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA).sql index 89a1fab0a9f..12f8c1e2441 100644 --- a/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(SqlServer.SA).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -26,8 +26,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA).sql b/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA).sql index 4d65f2e2444..6fe367a4843 100644 --- a/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test2(SqlServer.SA).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT TOP (10) [c_2].[ParentID], @@ -28,7 +28,7 @@ FROM ) [c_2] ORDER BY [c_2].[ParentID] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA).sql b/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA).sql index 491d334dd06..cdb744a3b1c 100644 --- a/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA).sql +++ b/SqlServer.SA/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test3(SqlServer.SA).sql @@ -4,10 +4,10 @@ DECLARE @take Int -- Int32 SET @take = 10 SELECT TOP (@take) - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT [c_2].[ParentID], @@ -29,7 +29,7 @@ FROM ORDER BY [c_2].[ParentID] OFFSET 10 ROWS FETCH NEXT 10 ROWS ONLY - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID] + [t3].[ParentID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed.LinqService).sql index d5a260f1470..02b20da6884 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed.LinqService).sql @@ -14,8 +14,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,1).sql b/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,1).sql index 25263c6d441..6e526298a1e 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,1).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,2).sql b/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,2).sql index 9b57a5b5cde..79162f3b42a 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,2).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed.LinqService,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed.LinqService).sql index 3f41581ce03..180d2d710a9 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed.LinqService).sql @@ -23,8 +23,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,14).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,14).sql index 4dee671b1ec..4a8dc54e86d 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,14).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,14).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,15).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,15).sql index d2a9138168e..21434d10647 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,15).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed.LinqService,15).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,14).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,14).sql index 6c9b35056bc..d7aa11cfa14 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,14).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,14).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,15).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,15).sql index 635d07ff433..f9f3b16eacd 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,15).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed.LinqService,15).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,14).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,14).sql index bd9bab4cb26..64856acfb2c 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,14).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,14).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,15).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,15).sql index 3a4141030b3..be5b7baab3c 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,15).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed.LinqService,15).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,14).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,14).sql index cae72cf6b66..39331775226 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,14).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,14).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,15).sql b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,15).sql index f5d2104a204..c0cce523554 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,15).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed.LinqService,15).sql @@ -387,10 +387,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed.LinqService).sql index 70f7c68f1c4..b865ebe84b1 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed.LinqService).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed.LinqService).sql index 3caf4d463c5..c88ddd0f9a8 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed.LinqService).sql index f6ff6b1d680..49fe5f00b21 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed.LinqService).sql @@ -2,13 +2,13 @@ -- Sybase.Managed Sybase SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed.LinqService).sql index df2a73c7d99..382d63837ab 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed.LinqService).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed.LinqService).sql index 882cfc33793..e322eb45d10 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed.LinqService).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed.LinqService).sql index 0ae1603317b..b7f878ea604 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed.LinqService).sql @@ -500,13 +500,13 @@ BeforeExecute -- Sybase.Managed Sybase SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) BeforeExecute -- Sybase.Managed Sybase @@ -520,13 +520,13 @@ BeforeExecute -- Sybase.Managed Sybase SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC BeforeExecute -- Sybase.Managed Sybase diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed.LinqService).sql index 9a5f0bead3c..0a9087f4896 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed.LinqService).sql @@ -500,13 +500,13 @@ BeforeExecute -- Sybase.Managed Sybase SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) BeforeExecute -- Sybase.Managed Sybase diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed.LinqService).sql index 85c111e029e..48b6569c307 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Sybase.Managed Sybase SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed.LinqService).sql index f8bccf58b7e..1a12a67b3f7 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed.LinqService).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed.LinqService).sql index f8bccf58b7e..12fddb0ed7e 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Sybase.Managed Sybase SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed.LinqService).sql index 01c2f9aaac2..9b8b26e7978 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed.LinqService).sql @@ -2,11 +2,11 @@ -- Sybase.Managed Sybase SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed.LinqService).sql index 705498817fd..cacec234d00 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed.LinqService).sql @@ -2,17 +2,21 @@ -- Sybase.Managed Sybase SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/Sybase.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..9875d42ad4e --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Sybase.Managed.LinqService).sql @@ -0,0 +1,158 @@ +BeforeExecute +-- Sybase.Managed Sybase + +IF (OBJECT_ID(N'CoalesceNullableFields') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- Sybase.Managed Sybase + +IF (OBJECT_ID(N'CoalesceNullableFields') IS NULL) + EXECUTE(' + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + ') + +BeforeExecute +-- Sybase.Managed Sybase +DECLARE @Id Integer -- Int32 +SET @Id = 1 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = 10 +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Sybase.Managed Sybase +DECLARE @Id Integer -- Int32 +SET @Id = 2 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = 20 +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Sybase.Managed Sybase +DECLARE @Id Integer -- Int32 +SET @Id = 3 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = 30 + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Sybase.Managed Sybase +DECLARE @Id Integer -- Int32 +SET @Id = 4 +DECLARE @Nullable1 Integer -- Int32 +SET @Nullable1 = NULL +DECLARE @Nullable2 Integer -- Int32 +SET @Nullable2 = NULL +DECLARE @Nullable3 Integer -- Int32 +SET @Nullable3 = NULL + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +VALUES +( + @Id, + @Nullable1, + @Nullable2, + @Nullable3 +) + +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- Sybase.Managed Sybase + +IF (OBJECT_ID(N'CoalesceNullableFields') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..2fd2c571072 --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Sybase.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..d5a62e759a0 --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Sybase.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed.LinqService).sql index 745d09bd803..d5a62e759a0 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed.LinqService).sql @@ -2,17 +2,10 @@ -- Sybase.Managed Sybase SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed.LinqService).sql index 0d42c717021..e462af2e758 100644 --- a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed.LinqService).sql @@ -2,14 +2,10 @@ -- Sybase.Managed Sybase SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..93064964c8b --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Sybase.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..07be8fb7f39 --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Sybase.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..e462af2e758 --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Sybase.Managed.LinqService).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..0c587cb1f2d --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Sybase.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..745d09bd803 --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Sybase.Managed.LinqService).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Sybase.Managed.LinqService).sql new file mode 100644 index 00000000000..0d42c717021 --- /dev/null +++ b/Sybase.Managed.LinqService/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Sybase.Managed.LinqService).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/Sybase.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed.LinqService).sql b/Sybase.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed.LinqService).sql index 172440d2b76..2a0e7d845e8 100644 --- a/Sybase.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed.LinqService).sql +++ b/Sybase.Managed.LinqService/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed.LinqService).sql @@ -2,10 +2,10 @@ -- Sybase.Managed Sybase SELECT TOP 10 - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -24,8 +24,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] diff --git a/Sybase.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed).sql index ed72767eec8..59a24565dd5 100644 --- a/Sybase.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/ElementOperationTests/Tests.Linq.ElementOperationTests.NestedFirstOrDefault4(Sybase.Managed).sql @@ -16,8 +16,8 @@ FROM ) [m_1] INNER JOIN ( SELECT DISTINCT - [d].[ParentID], - [d].[ChildID] + [d].[ChildID], + [d].[ParentID] FROM [Child] [d] WHERE diff --git a/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,1).sql b/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,1).sql index 25263c6d441..6e526298a1e 100644 --- a/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,1).sql +++ b/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,1).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,2).sql b/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,2).sql index 9b57a5b5cde..79162f3b42a 100644 --- a/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,2).sql +++ b/Sybase.Managed/Tests/Linq/EnumerableSourceTests/Tests.Linq.EnumerableSourceTests.ExpressionProjection(Sybase.Managed,2).sql @@ -9,11 +9,11 @@ SELECT [n].[FirstName], [n].[PersonID] FROM - [Person] [p] + [Person] [t1] INNER JOIN ( SELECT 'Janet' AS [FirstName], @ID AS [PersonID] UNION ALL - SELECT 'Doe', @ID_1) [n] ON [p].[PersonID] = [n].[PersonID] + SELECT 'Doe', @ID_1) [n] ON [t1].[PersonID] = [n].[PersonID] ORDER BY [n].[PersonID] diff --git a/Sybase.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed).sql index 3f41581ce03..180d2d710a9 100644 --- a/Sybase.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/ExpressionsTests/Tests.Linq.ExpressionsTests.Issue2434Test(Sybase.Managed).sql @@ -23,8 +23,7 @@ BeforeExecute SELECT [t1].[Id], [t1].[FirstName], - [t1].[LastName], - [t1].[FirstName] + ' ' + [t1].[LastName] + [t1].[LastName] FROM [Issue2434Table] [t1] ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,14).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,14).sql index 5d469bb31cf..6a2373b524b 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,14).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,14).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,15).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,15).sql index 660bab2e6db..96c135356e6 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,15).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr(Sybase.Managed,15).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,14).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,14).sql index 8e7b36e787d..abaef006bfc 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,14).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,14).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,15).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,15).sql index 01f32da71ef..4f0d5509a32 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,15).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestFormattableInExpr2(Sybase.Managed,15).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,14).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,14).sql index 6877ae75ddc..6f1f5999994 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,14).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,14).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,15).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,15).sql index 1b1d1626f86..40e6d25b8d9 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,15).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr(Sybase.Managed,15).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @endId - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,14).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,14).sql index 579dd0fee33..a51c70fe6cd 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,14).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,14).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,15).sql b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,15).sql index 1ec6b9bd836..89128d0772c 100644 --- a/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,15).sql +++ b/Sybase.Managed/Tests/Linq/FromSqlTests/Tests.Linq.FromSqlTests.TestParametersInExpr2(Sybase.Managed,15).sql @@ -56,10 +56,10 @@ SELECT [s].[value], [s].[id] FROM - [sample_class] [c_1] + [sample_class] [t1] INNER JOIN ( SELECT * FROM [sample_class] where [id] >= @startId and [id] < @p - ) [s] ON [s].[id] = [c_1].[id] + ) [s] ON [s].[id] = [t1].[id] WHERE [s].[id] > 10 ORDER BY diff --git a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed).sql index 70f7c68f1c4..b865ebe84b1 100644 --- a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.GroupJoin9(Sybase.Managed).sql @@ -4,8 +4,8 @@ SELECT [a_2].[ParentID], [a_2].[Value1], - [z_1].[ParentID], - [z_1].[Value1], + [z_2].[ParentID], + [z_2].[Value1], [y].[ParentID], [y].[Value1], [a].[ParentID], @@ -19,6 +19,13 @@ FROM LEFT JOIN [Parent] [y] ON [a_2].[ParentID] = [y].[ParentID] LEFT JOIN [Parent] [a] ON [a_2].[ParentID] = [a].[ParentID] LEFT JOIN [Parent] [z] ON [a_2].[ParentID] = [z].[ParentID] - LEFT JOIN [Parent] [z_1] ON [a_2].[ParentID] = Coalesce([z_1].[Value1], 1) + LEFT JOIN ( + SELECT + [z_1].[ParentID], + [z_1].[Value1], + Coalesce([z_1].[Value1], 1) as [c1] + FROM + [Parent] [z_1] + ) [z_2] ON [a_2].[ParentID] = [z_2].[c1] LEFT JOIN [Parent] [a_1] ON [a_2].[ParentID] = [a_1].[ParentID] diff --git a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed).sql index 3caf4d463c5..c88ddd0f9a8 100644 --- a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithConditions(Sybase.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id2 Integer -- Int32 SET @id2 = 2 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -17,7 +17,7 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 WHERE [right_1].[ParentID] <> @id2 AND [right2].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_1].[Value1] OR [right_2].[c1] IS NULL AND [left_1].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed).sql index f6ff6b1d680..49fe5f00b21 100644 --- a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutAllConditions(Sybase.Managed).sql @@ -2,13 +2,13 @@ -- Sybase.Managed Sybase SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM - [Parent] [left_1] + [Parent] [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed).sql index df2a73c7d99..382d63837ab 100644 --- a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnLeftWithoutConditions(Sybase.Managed).sql @@ -4,7 +4,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - [left_1].[ParentID], + [t1].[ParentID], [right_1].[ParentID] FROM ( @@ -15,10 +15,10 @@ FROM [Parent] [p] WHERE [p].[ParentID] <> @id1 - ) [left_1] + ) [t1] RIGHT JOIN [Parent] [right_1] INNER JOIN [Parent] [right2] ON [right_1].[Value1] = [right2].[Value1] + 2 - ON ([right_1].[Value1] + 2 = [left_1].[Value1] OR [right_1].[Value1] IS NULL AND [left_1].[Value1] IS NULL) + ON ([right_1].[Value1] + 2 = [t1].[Value1] OR [right_1].[Value1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_1].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed).sql index 882cfc33793..e322eb45d10 100644 --- a/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/JoinTests/Tests.Linq.JoinTests.SqlRightJoinWithInnerJoinOnRightWithConditions(Sybase.Managed).sql @@ -6,7 +6,7 @@ DECLARE @id1 Integer -- Int32 SET @id1 = 1 SELECT - [left_2].[ParentID], + [t1].[ParentID], [right_2].[ParentID] FROM ( @@ -18,7 +18,7 @@ FROM INNER JOIN [Parent] [left2] ON [left_1].[Value1] = [left2].[Value1] + 2 WHERE [left_1].[ParentID] <> @id2 AND [left2].[ParentID] <> @id1 - ) [left_2] + ) [t1] RIGHT JOIN ( SELECT [right_1].[ParentID], @@ -27,7 +27,7 @@ FROM [Parent] [right_1] WHERE [right_1].[ParentID] <> @id1 - ) [right_2] ON ([right_2].[c1] = [left_2].[Value1] OR [right_2].[c1] IS NULL AND [left_2].[Value1] IS NULL) + ) [right_2] ON ([right_2].[c1] = [t1].[Value1] OR [right_2].[c1] IS NULL AND [t1].[Value1] IS NULL) ORDER BY - [left_2].[ParentID] + [t1].[ParentID] diff --git a/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed).sql index 887ceaa510c..72dd9707b04 100644 --- a/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByDistinctTest(Sybase.Managed).sql @@ -61,13 +61,13 @@ BeforeExecute -- Sybase.Managed Sybase SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1]) + MAX([x].[OrderData1]) BeforeExecute -- Sybase.Managed Sybase @@ -81,13 +81,13 @@ BeforeExecute -- Sybase.Managed Sybase SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MIN([g_1].[OrderData1]) DESC + MIN([x].[OrderData1]) DESC BeforeExecute -- Sybase.Managed Sybase diff --git a/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed).sql index a9f4c9d8448..17a4299fc8e 100644 --- a/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByDistinctTests/Tests.Linq.OrderByDistinctTests.OrderByExpressionDistinctTests(Sybase.Managed).sql @@ -61,13 +61,13 @@ BeforeExecute -- Sybase.Managed Sybase SELECT TOP 3 - [g_1].[DuplicateData] + [x].[DuplicateData] FROM - [OrderByDistinctData] [g_1] + [OrderByDistinctData] [x] GROUP BY - [g_1].[DuplicateData] + [x].[DuplicateData] ORDER BY - MAX([g_1].[OrderData1] % 3) + MAX([x].[OrderData1] % 3) BeforeExecute -- Sybase.Managed Sybase diff --git a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed).sql index 85c111e029e..48b6569c307 100644 --- a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy10(Sybase.Managed).sql @@ -2,11 +2,11 @@ -- Sybase.Managed Sybase SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] DESC + [ch].[ChildID] % 2, + [ch].[ChildID] DESC diff --git a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed).sql index f8bccf58b7e..1a12a67b3f7 100644 --- a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy7(Sybase.Managed).sql @@ -7,6 +7,6 @@ SELECT FROM [Child] [x] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [x].[ChildID], + [x].[ChildID] % 2 diff --git a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed).sql index f8bccf58b7e..12fddb0ed7e 100644 --- a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy8(Sybase.Managed).sql @@ -2,11 +2,11 @@ -- Sybase.Managed Sybase SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2, - [x].[ChildID] + [ch].[ChildID] % 2, + [ch].[ChildID] diff --git a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed).sql index 01c2f9aaac2..9b8b26e7978 100644 --- a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderBy9(Sybase.Managed).sql @@ -2,11 +2,11 @@ -- Sybase.Managed Sybase SELECT - [x].[ParentID], - [x].[ChildID] + [ch].[ParentID], + [ch].[ChildID] FROM - [Child] [x] + [Child] [ch] ORDER BY - [x].[ChildID] % 2 DESC, - [x].[ChildID] DESC + [ch].[ChildID] % 2 DESC, + [ch].[ChildID] DESC diff --git a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed).sql index 705498817fd..cacec234d00 100644 --- a/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/OrderByTests/Tests.Linq.OrderByTests.OrderByContainsSubquery(Sybase.Managed).sql @@ -2,17 +2,21 @@ -- Sybase.Managed Sybase SELECT - [t1].[PersonID], - [t1].[LastName], - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[ID], + [t2].[LastName], + [t2].[flag] FROM - [Person] [t1] + ( + SELECT + CASE + WHEN [t1].[PersonID] IN (1, 3) THEN 1 + ELSE 0 + END as [flag], + [t1].[PersonID] as [ID], + [t1].[LastName] + FROM + [Person] [t1] + ) [t2] ORDER BY - CASE - WHEN [t1].[PersonID] IN (1, 3) THEN 1 - ELSE 0 - END + [t2].[flag] diff --git a/Sybase.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Sybase.Managed).sql new file mode 100644 index 00000000000..d3dd8cfb072 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/SelectTests/Tests.Linq.SelectTests.CoalesceMany(Sybase.Managed).sql @@ -0,0 +1,69 @@ +BeforeExecute +-- Sybase.Managed Sybase + +IF (OBJECT_ID(N'CoalesceNullableFields') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + +BeforeExecute +-- Sybase.Managed Sybase + +IF (OBJECT_ID(N'CoalesceNullableFields') IS NULL) + EXECUTE(' + CREATE TABLE [CoalesceNullableFields] + ( + [Id] Int NOT NULL, + [Nullable1] Int NULL, + [Nullable2] Int NULL, + [Nullable3] Int NULL, + + CONSTRAINT [PK_CoalesceNullableFields] PRIMARY KEY CLUSTERED ([Id]) + ) + ') + +BeforeExecute +-- Sybase.Managed Sybase + +INSERT INTO [CoalesceNullableFields] +( + [Id], + [Nullable1], + [Nullable2], + [Nullable3] +) +SELECT 1,10,NULL,NULL UNION ALL +SELECT 2,NULL,20,NULL UNION ALL +SELECT 3,NULL,NULL,30 UNION ALL +SELECT 4,NULL,NULL,NULL + +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable1], [t].[Nullable3], [t].[Id]), + Coalesce([t].[Nullable2], [t].[Nullable3], [t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable1], [t].[Nullable2], [t].[Id]), + Coalesce([t].[Nullable3], [t].[Nullable2], [t].[Nullable1], [t].[Id]), + [t].[Id], + Coalesce([t].[Nullable1], [t].[Id]), + Coalesce([t].[Nullable1], [t].[Nullable2], [t].[Id]) +FROM + [CoalesceNullableFields] [t] + +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [t1].[Id], + [t1].[Nullable1], + [t1].[Nullable2], + [t1].[Nullable3] +FROM + [CoalesceNullableFields] [t1] + +BeforeExecute +-- Sybase.Managed Sybase + +IF (OBJECT_ID(N'CoalesceNullableFields') IS NOT NULL) + DROP TABLE [CoalesceNullableFields] + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Sybase.Managed).sql new file mode 100644 index 00000000000..2fd2c571072 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Coalesce(Sybase.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND Coalesce([p].[MiddleName], 'None') = 'None' AND + [p].[FirstName] = 'John' + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Sybase.Managed).sql new file mode 100644 index 00000000000..d5a62e759a0 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional1(Sybase.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] = 1 + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed).sql index 745d09bd803..d5a62e759a0 100644 --- a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional2(Sybase.Managed).sql @@ -2,17 +2,10 @@ -- Sybase.Managed Sybase SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND - [p].[MiddleName] IS NULL AND - [p].[MiddleName] IS NULL AND - [p].[FirstName] IS NOT NULL AND - [p].[FirstName] IS NOT NULL + [p].[ParentID] = 1 diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed).sql index 0d42c717021..e462af2e758 100644 --- a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional3(Sybase.Managed).sql @@ -2,14 +2,10 @@ -- Sybase.Managed Sybase SELECT - [p].[FirstName], - [p].[PersonID], - [p].[LastName], - [p].[MiddleName], - [p].[Gender] + [p].[ParentID], + [p].[Value1] FROM - [Person] [p] + [Parent] [p] WHERE - [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND - NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + [p].[ParentID] <> 1 diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Sybase.Managed).sql new file mode 100644 index 00000000000..93064964c8b --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional4(Sybase.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[Value1] = 1 + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Sybase.Managed).sql new file mode 100644 index 00000000000..07be8fb7f39 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional5(Sybase.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + ([p].[Value1] <> 1 OR [p].[Value1] IS NULL) + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Sybase.Managed).sql new file mode 100644 index 00000000000..e462af2e758 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional6(Sybase.Managed).sql @@ -0,0 +1,11 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[ParentID], + [p].[Value1] +FROM + [Parent] [p] +WHERE + [p].[ParentID] <> 1 + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Sybase.Managed).sql new file mode 100644 index 00000000000..0c587cb1f2d --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional7(Sybase.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Sybase.Managed).sql new file mode 100644 index 00000000000..745d09bd803 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional8(Sybase.Managed).sql @@ -0,0 +1,18 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND + [p].[MiddleName] IS NULL AND + [p].[MiddleName] IS NULL AND + [p].[FirstName] IS NOT NULL AND + [p].[FirstName] IS NOT NULL + diff --git a/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Sybase.Managed).sql b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Sybase.Managed).sql new file mode 100644 index 00000000000..0d42c717021 --- /dev/null +++ b/Sybase.Managed/Tests/Linq/WhereTests/Tests.Linq.WhereTests.Conditional9(Sybase.Managed).sql @@ -0,0 +1,15 @@ +BeforeExecute +-- Sybase.Managed Sybase + +SELECT + [p].[FirstName], + [p].[PersonID], + [p].[LastName], + [p].[MiddleName], + [p].[Gender] +FROM + [Person] [p] +WHERE + [p].[PersonID] = 1 AND NOT ([p].[MiddleName] IS NOT NULL OR [p].[PersonID] = 2 OR [p].[MiddleName] IS NOT NULL) AND + NOT ([p].[FirstName] IS NULL OR [p].[PersonID] = 2 OR [p].[FirstName] IS NULL) + diff --git a/Sybase.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed).sql b/Sybase.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed).sql index 172440d2b76..2a0e7d845e8 100644 --- a/Sybase.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed).sql +++ b/Sybase.Managed/Tests/UserTests/Issue356Tests/Tests.UserTests.Issue356Tests.Test1(Sybase.Managed).sql @@ -2,10 +2,10 @@ -- Sybase.Managed Sybase SELECT TOP 10 - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID] FROM - [Parent] [x] + [Parent] [t3] INNER JOIN ( SELECT DISTINCT [c_2].[ParentID], @@ -24,8 +24,8 @@ FROM FROM [Child] [t1] ) [c_2] - ) [t2] ON [t2].[ParentID] = [x].[ParentID] + ) [t2] ON [t2].[ParentID] = [t3].[ParentID] ORDER BY - [x].[ParentID], + [t3].[ParentID], [t2].[ChildID]