CREATE OR REPLACE FUNCTION public.autonomous (p_script text)
RETURNS SETOF record
LANGUAGE plpgsql
VOLATILE STRICT PARALLEL UNSAFE
AS $autonomous$
DECLARE
l_id integer;
BEGIN
l_id := pg_background_launch(p_script);
RETURN QUERY SELECT * FROM pg_background_result(l_id) AS (r record);
END;
$autonomous$;
SELECT * FROM autonomous('SELECT now()') AS (a timestamptz);