How can I keep a result set without keeping the transaction open?
-
01-11-2019 - |
题
The following documentation describes how to see the refcursor returned from a function, here, like this:
CREATE FUNCTION reffunc(refcursor) RETURNS refcursor AS '
BEGIN
OPEN $1 FOR SELECT col FROM test;
RETURN $1;
END;
' LANGUAGE plpgsql;
BEGIN;
SELECT reffunc('funccursor');
FETCH ALL IN funccursor;
COMMIT;
This works for me. However, if I want to keep the results on my screen, I have to keep the transaction open. When I execute COMMIT, my result set is discarded. When I execute both FETCH and COMMIT at the same time, the first result set is discarded.
Is there a way to commit the transaction but keep the result set? The version of PgAdmin is 1.18.1.
没有正确的解决方案
不隶属于 dba.stackexchange