postgresqlf#type-providersfsharp.data.typeproviders

SqlProvider query errors with "unrecognized method call"


Environment:

The following query:

 query {
        for timing in db.Public.Timings do
        leftOuterJoin sensor in db.Public.Sensors on (timing.Transpondercode = sensor.Sensorcode) into r1            
        select timing
    }        

returns:

System.Exception: unrecognised method call
at Microsoft.FSharp.Linq.RuntimeHelpers.LeafExpressionConverter.EvaluateQuotation(FSharpExpr e)
at Microsoft.FSharp.Linq.QueryModule.EvalNonNestedInner(CanEliminate canElim, FSharpExpr queryProducingSequence)   
at Microsoft.FSharp.Linq.QueryModule.clo@1735-1.Microsoft-FSharp-Linq-ForwardDeclarations-IQueryMethods-Execute[a,b](FSharpExpr`1 )
at AlphaFront.Db.getTimings(Double startTime, Double endTime) in C:\projects\AlphaFront\AlphaFront\Db.fs:line 488

Other queries, including joins have been working great, but this is the first left join I have tried.

edit: I've simplified the code example to the smallest reproducing example.


Solution

  • It looks like as of Oct 15 2015, leftOuterJoin just isn't supported by SqlProvider

    Quoting maintainer pezipink from github

    For outer joins, the leftOuterJoin keyword is not supported as it requires us to implement groupJoin which in turns requires a bunch of other stuff that has not been done yet. If your join is between fields with foreign keys setup, you can get it to left join by using the special (!!) operator within the for.. syntax, eg for prod in (!!) table1.MyForeignKey do...