I have two SQL functions (procedures) in postgresql. They take and return array; their signatures are
create function arr_ret( x int) returns int[] as
and
create function arr_param( x int[] ) returns int as
The first function when executed returns
> ctx.Functions.ArrRet.Invoke(6);;
Executing SQL : EXEC arr_ret(6) - params
val it : Unit = ()
>
As can be seen, the signature of the invoke operation is Unit() = (); doesn't return anything. I would have expected Unit() = int list because the procedure is expected to return an array of integers.
The second function when executed
> ctx.Functions.ArrParam.Invoke( [1;2;3;4;5;6] );;
ctx.Functions.ArrParam.Invoke( [1;2;3;4;5;6] );;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
stdin(22,1): error FS0501: The member or object constructor 'Invoke' takes 0 argument(s) but is here given 1. The requir
ed signature is 'SqlDataProvider<...>.dataContext.Functions.ArrParam.Result.Invoke() : SqlDataProvider<...>.dataContext.
Functions.ArrParam.Result.SprocResult'.
Npgsql is not seeing the parameter (either input or output) that is of array type. The documentation says postgresql array and composite types are supported from 3.0+ version and I am using the latest 3.2.3
[1;2;3;4;5;6]is a list. To create an array in F#, the delimeters should be[|and|]instead of[and]. Try replacing[1;2;3;4;5;6]with[|1;2;3;4;5;6|]and see if that solves your problem.