Si desea devolver un resultado, debe usar return query
en PL/pgSQL como se documenta en el manual
CREATE OR REPLACE FUNCTION dwgcould.returnallcolumns(IN sessionId character varying)
RETURNS SETOF public.mytable AS
$BODY$
BEGIN
return query --<< this was missing
SELECT *
FROM public.mytable
WHERE session_id = returnallcolumns.sessionId
ORDER BY pro_id DESC LIMIT 1;
END;
$BODY$
LANGUAGE plpgsql VOLATILE;
Pero no necesita PL/pgSQL para esto, una función SQL simple será más eficiente:
CREATE OR REPLACE FUNCTION dwgcould.returnallcolumns(IN sessionId character varying)
RETURNS SETOF public.mytable AS
$BODY$
SELECT *
FROM public.mytable
WHERE session_id = returnallcolumns.sessionId
ORDER BY pro_id DESC LIMIT 1;
$BODY$
LANGUAGE sql;