0

Datagrip cannot read from cursor for the below query:

SELECT public.get_user_summary('ALL');
FETCH ALL FROM ref1;

Function code:

CREATE OR REPLACE FUNCTION public.get_user_summary(username text)
  RETURNS refcursor AS
$BODY$
DECLARE ref1 refcursor := 'ref1';
BEGIN
    OPEN ref1 FOR
    select * FROM public.user_details where user_name=username;
    RETURN ref1;
END
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

it works on pgAdmin but datagrip gives below error:

<failed to load>
org.postgresql.util.PSQLException: ERROR: cursor "ref1" does not exist

Is there a solution for this?

gmsi
  • 1,062
  • 1
  • 16
  • 29

0 Answers0