fsharp
fsharp copied to clipboard
Query expression with join on tuple doesn't work
Joining on a composite key tuple within a query expression doesn't seem to work for plain records. Note that this does work when using SQLProvider.
Repro steps
Repro repo is here. Basically queries that join on a tuple return nothing.
No matches are returned from this, even when matches exist in the underlying data:
let joinedInline =
query {
for t1 in queryable1s do
join t2 in queryable2s on ((t1.Id1, t1.Id2) = (t2.Id1, t2.Id2))
select (t1.Key, t2.Value)
}
When the tuples are created in a function, matches are returned correctly:
let joinedFunction =
query {
for t1 in queryable1s do
join t2 in queryable2s on (Test1.Composite t1 = Test2.Composite t2)
select (t1.Key, t2.Value)
}
Expected behavior
A query with a join should return matches based on tuple equality. In other words, the two above queries should be equivalent.
Actual behavior
No matches are returned for inline tuple joins.
Known workarounds
Call a function to generate the tuple inside the join condition. Note: this is not supported by SQLProvider.
Related information
- .NET Core 3.0