pg_cron icon indicating copy to clipboard operation
pg_cron copied to clipboard

failure due to bad nodename does not have start_time/end_time

Open bsislow opened this issue 1 year ago • 0 comments

when a job such as this runs, and nodename is bad (for example, it can also happen with database or username i believe), cron.job_run_details does not record a start or end time:

SELECT cron.schedule('this will fail', '* * * * *', 'call doesnotexist()');

result:

postgres=# select * from cron.job_run_details ;
-[ RECORD 1 ]--+----------------------------------------------------------------------------------------------------------
jobid          | 1
runid          | 1
job_pid        |
database       | postgres
username       | postgres
command        | call doesnotexist()
status         | failed
return_message | connection failed
start_time     |
end_time       |

shouldn't a start_time and end_time be recorded anyway?

we're developing in-house monitoring that runs, say, every hour... and want to check any records in job_run_details that fit the window of the last hour based on now(). we cannot do this with null date records...

thanks.

bsislow avatar Feb 23 '23 13:02 bsislow