I got an InvalidOperationException with message "Could not format node 'New' for execution as SQL." at the following query.
var source = db.Users.Where(a => (bool)db.Filter(a, keyword)).ToList();
here "Filter" is a database function that have two parameters and returns boolean.
I'm using linq to postgresql ,
and I expect that generated sql query like "select u.* from userrs u where filter(u, 'hebele')"
Could not format node 'New' for execution as SQL
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
Thanks for your interest.
I'm using postgresql 9.0.
My function accepts takes record as parameter, not a field value. So, my linq query likes "db.Filter(a, keyword)" not "db.Filter(a.Name, keyword)". this is the main difference.
I don't know, this usage my be silly.
Probably database servers except postgresql does not support this usage.
I'm using postgresql 9.0.
My function accepts takes record as parameter, not a field value. So, my linq query likes "db.Filter(a, keyword)" not "db.Filter(a.Name, keyword)". this is the main difference.
I don't know, this usage my be silly.
Probably database servers except postgresql does not support this usage.
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
In this case, the problem is that an object of a custom type (i.e., the row type of the 'users' table) actually should be passed as a function argument. Since LinqConnect does not support user-defined types, such an operation is not allowed.
A possible way to resolve the issue is to create (and use in the model) an overload of the 'filter' function that takes parameters of simple types only.
A possible way to resolve the issue is to create (and use in the model) an overload of the 'filter' function that takes parameters of simple types only.