You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please add documentation and examples on working with refcursors. When calling a procedure with Connection::call() that has an INOUT refcursor parameter, in the lambda handler, in row, one record with one column is returned, with the value <unnamed portal 1>.
Procedure example:
CREATE OR REPLACE PROCEDURE public.get_objects(
IN pstartofinterval bigint,
IN pendofinterval bigint,
INOUT cr refcursor);
In my example, the refcursor cr should return jsonb objects. The pstartofinterval and pendofinterval parameters determine which specific objects to return. In this case, it doesn't matter which. The question is how to get them.
@dmitigr hi. yes, thanks for the info. But, unfortunately, our project has already implemented a solution with a refcursor.
I will give an example of a solution with a cursor, using the current capabilities of the dmitigr::pgfe library, that we used. Perhaps someone will be useful.
In this example calls the public.get_objects() procedure described above. pgfe::Transaction_guard is needed to ensure that a transaction is not committ(or rollback) until the cursor has finished reading. Calling a procedure and reading from a cursor(fetch) must be called with different commands, as shown below.
Please add documentation and examples on working with refcursors. When calling a procedure with Connection::call() that has an INOUT refcursor parameter, in the lambda handler, in row, one record with one column is returned, with the value <unnamed portal 1>.
Procedure example:
CREATE OR REPLACE PROCEDURE public.get_objects(
IN pstartofinterval bigint,
IN pendofinterval bigint,
INOUT cr refcursor);
In my example, the refcursor cr should return jsonb objects. The pstartofinterval and pendofinterval parameters determine which specific objects to return. In this case, it doesn't matter which. The question is how to get them.
Example code:
Thanks.
The text was updated successfully, but these errors were encountered: