Hi Paul Hernandez,
We have got the below reply:
The approach involves creating stored procedures or functions with the SECURITY DEFINER attribute. These functions can leverage the cron.* functions to schedule jobs. By granting execute permissions on the newly created procedure/function to the target user, you can enable them to trigger these scheduled tasks with no need to have azure_pg_admin, for example:
CREATE OR REPLACE FUNCTION my_secure_schedule(schedule text, command text)
RETURNS bigint
LANGUAGE plpgsql
SECURITY DEFINER
AS $$
DECLARE
job_id bigint;
BEGIN
-- Call the cron.schedule function
job_id := cron.schedule(schedule, command);
-- Return the job ID
RETURN job_id;
END;
$$;
And after that you can grant -- GRANT EXECUTE ON FUNCTION my_secure_schedule(text, text) TO myuser;
Now myuser can run my_secure_schedule, and that function if you can see the definition shared before can schedule jobs to run. He can do the rest for cron functions with the same way based on his needs.
Hope this helps. If this answers your query, do click Accept Answer
and Mark Helpful
for the same. And, if you have any further query do let us know.
Thanks