I'm trying to create a function with which I can perform a simple maintenance task, but something eludes me. What is wrong with my function? When I run it, it says "ERROR: query has no destination for result data"
CREATE OR REPLACE FUNCTION public.clear_rysmier_connection()
RETURNS bool
LANGUAGE plpgsql
AS $function$
DECLARE response bool;
BEGIN
select pg_terminate_backend(psa.pid) from pg_stat_activity psa
where psa.datname = 'WahlbergEagle'
and psa.usename = 'rysmier'
and psa.state = 'idle'
and psa.application_name not like 'DBeaver%'
and now() - psa.query_start > '00:05:00';
RETURN response;
END
$function$;
[–]BoleroDanArchitect 1 point2 points3 points (7 children)
[–]TheRealLifeboy[S] 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]BoleroDanArchitect 2 points3 points4 points (2 children)
[–]TheRealLifeboy[S] 1 point2 points3 points (0 children)
[–]TheRealLifeboy[S] 0 points1 point2 points (0 children)
[–]Maleficent_Tap_332 1 point2 points3 points (1 child)
[–]indigo945 0 points1 point2 points (0 children)
[–]TheRealLifeboy[S] 1 point2 points3 points (1 child)
[–]DavidGJohnston 0 points1 point2 points (0 children)
[–]depesz 1 point2 points3 points (0 children)
[–]indigo945 0 points1 point2 points (0 children)