In Hasura, I'm trying write a plpgsql based function which should return the t_documents. The function should accept various optional arguments, based on the argument values it should run appropriate SQL (using IF conditional checks) and return the records. This is my goal.
I've started with simple function with no arguments, the function created and tracked successfully in Hasura, however when try to query it throws "query has no destination for result data"
Any help to achieve the goal is highly appreciated
CREATE OR REPLACE FUNCTION dms.fngetdocs()
RETURNS SETOF dms.t_documents
LANGUAGE plpgsql
STABLE
AS $function$
BEGIN
SELECT *
FROM dms.t_documents;
END;
$function$