File: pg_cron--1.3--1.4.sql

package info (click to toggle)
pg-cron 1.6.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: ansic: 3,672; sql: 213; makefile: 28; sh: 27
file content (44 lines) | stat: -rw-r--r-- 1,638 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* pg_cron--1.3--1.4.sql */

/* cron_schedule_named expects job name to be text */
DROP FUNCTION cron.schedule(name,text,text);
CREATE FUNCTION cron.schedule(job_name text,
                              schedule text,
                              command text)
RETURNS bigint
LANGUAGE C
AS 'MODULE_PATHNAME', $$cron_schedule_named$$;
COMMENT ON FUNCTION cron.schedule(text,text,text)
IS 'schedule a pg_cron job';

CREATE FUNCTION cron.alter_job(job_id bigint,
								schedule text default null,
								command text default null,
								database text default null,
								username text default null,
								active boolean default null)
RETURNS void
LANGUAGE C
AS 'MODULE_PATHNAME', $$cron_alter_job$$;

COMMENT ON FUNCTION cron.alter_job(bigint,text,text,text,text,boolean)
IS 'Alter the job identified by job_id. Any option left as NULL will not be modified.';

/* admin should decide whether alter_job is safe by explicitly granting execute */
REVOKE ALL ON FUNCTION cron.alter_job(bigint,text,text,text,text,boolean) FROM public;

CREATE FUNCTION cron.schedule_in_database(job_name text,
										  schedule text,
										  command text,
										  database text,
										  username text default null,
										  active boolean default 'true')
RETURNS bigint
LANGUAGE C
AS 'MODULE_PATHNAME', $$cron_schedule_named$$;

COMMENT ON FUNCTION cron.schedule_in_database(text,text,text,text,text,boolean)
IS 'schedule a pg_cron job';

/* admin should decide whether cron.schedule_in_database is safe by explicitly granting execute */
REVOKE ALL ON FUNCTION cron.schedule_in_database(text,text,text,text,text,boolean) FROM public;