Skip to content
Advertisement

F# Query Exception, “unrecognized method call value”

Q: What does the following exception mean?


I’m attempting to translate a Pervasive SQL query to an F# query using SqlDataProvider with an ODBC connection, building up slowly bit by bit. I’m getting an exception with the following query with a somewhat cryptic exception.

When the printfn statement is executed and the expression is actually evaluated, the exception is hit:

This is all part of a larger query which has the exact same exception when it is executed:


FYI, the SQL query from which this F# query is translated is as follows (the SELECT statement is not as important as the JOIN clauses where the F# exception is thrown):

Advertisement

Answer

After reading some SO answers and GitHub issues (linked below), it seems that the exact operation on this kind of SQL database in the way I am doing it just isn’t supported at the moment (maybe? at least as I understand what I read), although apparently left joins in query expressions are possible with the !! operator — but I have not had success with it as of yet.

I have however found the following clunky workaround using the same query expression I had been using by forcing the data to be read into memory by transforming the data into a List (or Array, etc) first:

Which can then be used in the original query expression with minimal change.

This is of course very inefficient (reading in 62k+ rows of DsItem uses around 500MB+ of memory and takes 30+ seconds to read), but it does actually work…


Links:

SO: F# groupBy – System.Exception : unrecognized method call

GitHub: “unrecognised method call value” on a left outer join #588

GitHub: Ordering of joins can cause runtime exception with (!!) #614

GitHub: leftOuterJoin causing “unrecognized method call” with Postgresql #235

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement