I'm running pg_cron jobs that of course runs from the default postgres db.
I have some functions/procedures that I created in another database called test, and have ran assigned these pg_cron jobs to the correct new database via (example):
select cron.schedule ('some_random_function',
'* * * * *',
'call test.my_random_funct()'
);
UPDATE cron.job SET database = 'test';
I know this works because when I had the function/procedure in the public schema of the test database, everything worked. However, I have a another schema in the test database I want to use, called poop, but when I schedule the pg_cron job on this database and schema, all I get are error messages that the function/procedure doesn't exist (even though it does exist).
Do I have to grant some permissions or something or some schema? I'm running under a sysadmin account so it should have all needed privileges...
sample error message that shows up in cron.job_run_details
:
ERROR: procedure my_rand_funct() does not exist
HINT: No procedure matches the given name and argument types. You might need to add explicit type casts.
\df
command in psql show more than one definition? Also, the function name seems to keep changing in your question (test.my_random_funct()
becomesmy_rand_funct()
in the error message), make sure you are calling the correct one with the correct arguments.