Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timescale run_job() cannot find defined FUNCTION/PROCEDURE

i am creating a PROCEDURE in TimescaleDB (which is based on PostgreSQL) like this:

CREATE or replace procedure insert_oee()
LANGUAGE SQL
as $$
INSERT INTO public.oee_t1 (columns)
    (select
        some_columns
     from
     a_table)
$$;

Which works fine and does not return any error when creating.

and then I am creating a job like this:

SELECT add_job('job_name','24h',initial_start=> 'some_date')

which works fine too.

and then when trying to run it like this:

call run_job(1002)

i get the error 'function public.insert_oee(job_id INT, config JSONB) not found'

but if I list all the procedures like this:

SELECT
*
FROM 
    information_schema.routines
WHERE 
    routine_type = 'PROCEDURE'

the procedure is listed.

Why do I get the error?

like image 898
morphineglelly Avatar asked Dec 05 '25 10:12

morphineglelly


1 Answers

this post can be helpful: there are some parameters to be specified as it is said in this documentation page.

You (that's funny) are missing the arguments when creating the procedure, run it again with this header and it will be fine; even if you pass nothing (which is equivalent to null,null) it will run fine.

CREATE or replace procedure insert_oee(job_id INT, config JSONB)

with the standard parameters specified.

like image 196
morphineglelly Avatar answered Dec 08 '25 02:12

morphineglelly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!