Run_job() cannot find function - cache lookup failed for function 0

I am running self-hosted TimescaleDB. I created a function called trim_events that will check hypertable size and delete old chunks if the size of the hypertable exceeds a certain threshold. I am trying to run it hourly using the add_job() function.

The function itself works fine if I run it manually using SELECT trim_events(); from the psql console.

I created the job using SELECT add_job('trim_events', '1h');. No problems there, it returns the job_id of 1008.

However, checking the job history, I can see that the job fails every time with cache lookup failed for function 0. If I try to run the job with CALL run_job(1008);, I get the same error.

How can I resolve this issue?

What is the signature of your function? Job functions need to have 2 arguments (int, jsonb)

Thanks! That requirement wasn’t clear to me and I had a third argument in the signature. I suppose that’s what the config argument is for, huh? Anyway, I removed that argument and it seems to be working now.

Question - does timescaledb_information.job_history only show jobs that have errors? I don’t see successful runs showing up there.