|
| 1 | +/* pg_cron--1.3--1.4.sql */ |
| 2 | + |
| 3 | +/* cron_schedule_named expects job name to be text */ |
| 4 | +DROP FUNCTION cron.schedule(name,text,text); |
| 5 | +CREATE FUNCTION cron.schedule(job_name text, |
| 6 | + schedule text, |
| 7 | + command text) |
| 8 | +RETURNS bigint |
| 9 | +LANGUAGE C |
| 10 | +AS 'MODULE_PATHNAME', $$cron_schedule_named$$; |
| 11 | +COMMENT ON FUNCTION cron.schedule(text,text,text) |
| 12 | +IS 'schedule a pg_cron job'; |
| 13 | + |
| 14 | +CREATE FUNCTION cron.alter_job(job_id bigint, |
| 15 | + schedule text default null, |
| 16 | + command text default null, |
| 17 | + database text default null, |
| 18 | + username text default null, |
| 19 | + active boolean default null) |
| 20 | +RETURNS void |
| 21 | +LANGUAGE C |
| 22 | +AS 'MODULE_PATHNAME', $$cron_alter_job$$; |
| 23 | + |
| 24 | +COMMENT ON FUNCTION cron.alter_job(bigint,text,text,text,text,boolean) |
| 25 | +IS 'Alter the job identified by job_id. Any option left as NULL will not be modified.'; |
| 26 | + |
| 27 | +/* admin should decide whether alter_job is safe by explicitly granting execute */ |
| 28 | +REVOKE ALL ON FUNCTION cron.alter_job(bigint,text,text,text,text,boolean) FROM public; |
| 29 | + |
| 30 | +CREATE FUNCTION cron.schedule_in_database(job_name text, |
| 31 | + schedule text, |
| 32 | + command text, |
| 33 | + database text, |
| 34 | + username text default null, |
| 35 | + active boolean default 'true') |
| 36 | +RETURNS bigint |
| 37 | +LANGUAGE C |
| 38 | +AS 'MODULE_PATHNAME', $$cron_schedule_named$$; |
| 39 | + |
| 40 | +COMMENT ON FUNCTION cron.schedule_in_database(text,text,text,text,text,boolean) |
| 41 | +IS 'schedule a pg_cron job'; |
| 42 | + |
| 43 | +/* admin should decide whether cron.schedule_in_database is safe by explicitly granting execute */ |
| 44 | +REVOKE ALL ON FUNCTION cron.schedule_in_database(text,text,text,text,text,boolean) FROM public; |
0 commit comments