Welton3 wrote:command.Parameters["aCURSOR_ARRAY"].PgSqlValue actually returns an array of string: {"<unnamed portal 1>","<unnamed portal 2>"}
If you execute the following query in pgAdmin: SELECT refcursorfuncx('select 123 as a; select 456 as b;');
You will get the following result: "{"<unnamed portal 1>","<unnamed portal 2>"}".
For example, the result of a query: SELECT refcursorfunc2();
where refcursorfunc2 is described above, in pgAdmin is similar: "("<unnamed portal 1>","<unnamed portal 2>")". This is the expected result. But at the same time, with dotConnect for PostgreSQL you were able get cursors from the refcursorfunc2 function.
Your aCURSOR_ARRAY parameter is an array. For more information, please refer to
https://www.devart.com/dotconnect/postg ... lType.html
And it can be read as PgSqlArray. For more information, please refer to
https://www.devart.com/dotconnect/postg ... Array.html
Thus you need to replace th following code:
Code: Select all
var result = command.Parameters["aCURSOR_ARRAY"].PgSqlValue as PgSqlCursor[];
on the code:
Code: Select all
var result = (PgSqlArray)command.Parameters["aCURSOR_ARRAY"].PgSqlValue;
Your GetCursors function, respectively, must return the PgSqlArray type instead of PgSqlCursor[].
However, we reproduced the issue with reading cursors from PgSqlArray object. They are read as String and not as PgSqlCursor. We will investigate the issue and post here about the results as soon as possible. When the issue is fixed, we will provide an example of how to use PgSqlArray for reading an array of cursors.