forked from npgsql/efcore.pg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNavigationsPrimitiveCollectionNpgsqlTest.cs
More file actions
166 lines (153 loc) · 15.7 KB
/
NavigationsPrimitiveCollectionNpgsqlTest.cs
File metadata and controls
166 lines (153 loc) · 15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
namespace Microsoft.EntityFrameworkCore.Query.Associations.Navigations;
public class NavigationsPrimitiveCollectionNpgsqlTest(NavigationsNpgsqlFixture fixture, ITestOutputHelper testOutputHelper)
: NavigationsPrimitiveCollectionRelationalTestBase<NavigationsNpgsqlFixture>(fixture, testOutputHelper)
{
public override async Task Count()
{
await base.Count();
AssertSql(
"""
SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."Id", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."Id", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."Id", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."Id", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String"
FROM "RootEntity" AS r
INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id"
LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id"
LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id"
LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id"
LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id"
INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id"
LEFT JOIN (
SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."Id" AS "Id1", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."Id" AS "Id2", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2"
FROM "AssociateType" AS a1
LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id"
INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id"
LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId"
) AS s ON r."Id" = s."CollectionRootId"
LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId"
LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId"
WHERE cardinality(a."Ints") = 3
ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, n6."Id" NULLS FIRST
""");
}
public override async Task Index()
{
await base.Index();
AssertSql(
"""
SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."Id", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."Id", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."Id", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."Id", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String"
FROM "RootEntity" AS r
INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id"
LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id"
LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id"
LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id"
LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id"
INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id"
LEFT JOIN (
SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."Id" AS "Id1", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."Id" AS "Id2", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2"
FROM "AssociateType" AS a1
LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id"
INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id"
LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId"
) AS s ON r."Id" = s."CollectionRootId"
LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId"
LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId"
WHERE a."Ints"[1] = 1
ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, n6."Id" NULLS FIRST
""");
}
public override async Task Contains()
{
await base.Contains();
AssertSql(
"""
SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."Id", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."Id", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."Id", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."Id", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String"
FROM "RootEntity" AS r
INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id"
LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id"
LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id"
LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id"
LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id"
INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id"
LEFT JOIN (
SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."Id" AS "Id1", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."Id" AS "Id2", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2"
FROM "AssociateType" AS a1
LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id"
INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id"
LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId"
) AS s ON r."Id" = s."CollectionRootId"
LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId"
LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId"
WHERE 3 = ANY (a."Ints")
ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, n6."Id" NULLS FIRST
""");
}
public override async Task Any_predicate()
{
await base.Any_predicate();
AssertSql(
"""
SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."Id", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n."Id", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String", n0."Id", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", n2."Id", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String"
FROM "RootEntity" AS r
INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id"
LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id"
LEFT JOIN "NestedAssociateType" AS n ON a0."OptionalNestedAssociateId" = n."Id"
LEFT JOIN "NestedAssociateType" AS n0 ON a0."RequiredNestedAssociateId" = n0."Id"
LEFT JOIN "NestedAssociateType" AS n1 ON a."OptionalNestedAssociateId" = n1."Id"
INNER JOIN "NestedAssociateType" AS n2 ON a."RequiredNestedAssociateId" = n2."Id"
LEFT JOIN (
SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."Id" AS "Id1", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."Id" AS "Id2", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2"
FROM "AssociateType" AS a1
LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id"
INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id"
LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId"
) AS s ON r."Id" = s."CollectionRootId"
LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId"
LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId"
WHERE 2 = ANY (a."Ints")
ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, n6."Id" NULLS FIRST
""");
}
public override async Task Nested_Count()
{
await base.Nested_Count();
AssertSql(
"""
SELECT r."Id", r."Name", r."OptionalAssociateId", r."RequiredAssociateId", s."Id", s."CollectionRootId", s."Int", s."Ints", s."Name", s."OptionalNestedAssociateId", s."RequiredNestedAssociateId", s."String", s."Id0", s."CollectionAssociateId", s."Int0", s."Ints0", s."Name0", s."String0", s."Id1", s."CollectionAssociateId0", s."Int1", s."Ints1", s."Name1", s."String1", s."Id2", s."CollectionAssociateId1", s."Int2", s."Ints2", s."Name2", s."String2", a0."Id", a0."CollectionRootId", a0."Int", a0."Ints", a0."Name", a0."OptionalNestedAssociateId", a0."RequiredNestedAssociateId", a0."String", n6."Id", n6."CollectionAssociateId", n6."Int", n6."Ints", n6."Name", n6."String", n0."Id", n0."CollectionAssociateId", n0."Int", n0."Ints", n0."Name", n0."String", n1."Id", n1."CollectionAssociateId", n1."Int", n1."Ints", n1."Name", n1."String", a."Id", a."CollectionRootId", a."Int", a."Ints", a."Name", a."OptionalNestedAssociateId", a."RequiredNestedAssociateId", a."String", n7."Id", n7."CollectionAssociateId", n7."Int", n7."Ints", n7."Name", n7."String", n2."Id", n2."CollectionAssociateId", n2."Int", n2."Ints", n2."Name", n2."String", n."Id", n."CollectionAssociateId", n."Int", n."Ints", n."Name", n."String"
FROM "RootEntity" AS r
INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id"
INNER JOIN "NestedAssociateType" AS n ON a."RequiredNestedAssociateId" = n."Id"
LEFT JOIN "AssociateType" AS a0 ON r."OptionalAssociateId" = a0."Id"
LEFT JOIN "NestedAssociateType" AS n0 ON a0."OptionalNestedAssociateId" = n0."Id"
LEFT JOIN "NestedAssociateType" AS n1 ON a0."RequiredNestedAssociateId" = n1."Id"
LEFT JOIN "NestedAssociateType" AS n2 ON a."OptionalNestedAssociateId" = n2."Id"
LEFT JOIN (
SELECT a1."Id", a1."CollectionRootId", a1."Int", a1."Ints", a1."Name", a1."OptionalNestedAssociateId", a1."RequiredNestedAssociateId", a1."String", n5."Id" AS "Id0", n5."CollectionAssociateId", n5."Int" AS "Int0", n5."Ints" AS "Ints0", n5."Name" AS "Name0", n5."String" AS "String0", n3."Id" AS "Id1", n3."CollectionAssociateId" AS "CollectionAssociateId0", n3."Int" AS "Int1", n3."Ints" AS "Ints1", n3."Name" AS "Name1", n3."String" AS "String1", n4."Id" AS "Id2", n4."CollectionAssociateId" AS "CollectionAssociateId1", n4."Int" AS "Int2", n4."Ints" AS "Ints2", n4."Name" AS "Name2", n4."String" AS "String2"
FROM "AssociateType" AS a1
LEFT JOIN "NestedAssociateType" AS n3 ON a1."OptionalNestedAssociateId" = n3."Id"
INNER JOIN "NestedAssociateType" AS n4 ON a1."RequiredNestedAssociateId" = n4."Id"
LEFT JOIN "NestedAssociateType" AS n5 ON a1."Id" = n5."CollectionAssociateId"
) AS s ON r."Id" = s."CollectionRootId"
LEFT JOIN "NestedAssociateType" AS n6 ON a0."Id" = n6."CollectionAssociateId"
LEFT JOIN "NestedAssociateType" AS n7 ON a."Id" = n7."CollectionAssociateId"
WHERE cardinality(n."Ints") = 3
ORDER BY r."Id" NULLS FIRST, s."Id" NULLS FIRST, s."Id0" NULLS FIRST, n6."Id" NULLS FIRST
""");
}
public override async Task Select_Sum()
{
await base.Select_Sum();
AssertSql(
"""
SELECT (
SELECT COALESCE(sum(i0.value), 0)::int
FROM unnest(a."Ints") AS i0(value))
FROM "RootEntity" AS r
INNER JOIN "AssociateType" AS a ON r."RequiredAssociateId" = a."Id"
WHERE (
SELECT COALESCE(sum(i.value), 0)::int
FROM unnest(a."Ints") AS i(value)) >= 6
""");
}
[ConditionalFact]
public virtual void Check_all_tests_overridden()
=> TestHelpers.AssertAllMethodsOverridden(GetType());
}