@@ -42,6 +42,8 @@ SELECT add_job('custom_func', NULL);
42
42
ERROR: schedule interval cannot be NULL
43
43
SELECT add_job('custom_func', 'invalid interval');
44
44
ERROR: invalid input syntax for type interval: "invalid interval" at character 31
45
+ SELECT add_job('custom_func', '1h', job_name := 'this_is_a_really_really_really_long_application_name_to_overflow');
46
+ ERROR: application name "this_is_a_really_really_really_long_application_name_to_overflo [1000]": too long.
45
47
\set ON_ERROR_STOP 1
46
48
select '2000-01-01 00:00:00+00' as time_zero \gset
47
49
SELECT add_job('custom_func','1h', config:='{"type":"function"}'::jsonb, initial_start => :'time_zero'::TIMESTAMPTZ);
@@ -68,7 +70,7 @@ SELECT add_job('custom_func', '1h', config:='{"type":"function"}'::jsonb, initia
68
70
1003
69
71
(1 row)
70
72
71
- SELECT add_job('custom_func_definer', '1h', config:='{"type":"function"}'::jsonb, initial_start => :'time_zero'::TIMESTAMPTZ);
73
+ SELECT add_job('custom_func_definer', '1h', config:='{"type":"function"}'::jsonb, initial_start => :'time_zero'::TIMESTAMPTZ, job_name := 'custom_job_name' );
72
74
add_job
73
75
---------
74
76
1004
@@ -82,7 +84,7 @@ SELECT * FROM timescaledb_information.jobs WHERE job_id >= 1000 ORDER BY 1;
82
84
1001 | User-Defined Action [1001] | @ 1 hour | @ 0 | -1 | @ 5 mins | public | custom_proc | default_perm_user | t | t | {"type": "procedure"} | Fri Dec 31 16:00:00 1999 PST | Fri Dec 31 16:00:00 1999 PST | | | |
83
85
1002 | User-Defined Action [1002] | @ 1 hour | @ 0 | -1 | @ 5 mins | public | custom_proc2 | default_perm_user | t | t | {"type": "procedure"} | Fri Dec 31 16:00:00 1999 PST | Fri Dec 31 16:00:00 1999 PST | | | |
84
86
1003 | User-Defined Action [1003] | @ 1 hour | @ 0 | -1 | @ 5 mins | public | custom_func | default_perm_user | t | t | {"type": "function"} | Fri Dec 31 16:00:00 1999 PST | Fri Dec 31 16:00:00 1999 PST | | | |
85
- 1004 | User-Defined Action [1004] | @ 1 hour | @ 0 | -1 | @ 5 mins | public | custom_func_definer | default_perm_user | t | t | {"type": "function"} | Fri Dec 31 16:00:00 1999 PST | Fri Dec 31 16:00:00 1999 PST | | | |
87
+ 1004 | custom_job_name [1004] | @ 1 hour | @ 0 | -1 | @ 5 mins | public | custom_func_definer | default_perm_user | t | t | {"type": "function"} | Fri Dec 31 16:00:00 1999 PST | Fri Dec 31 16:00:00 1999 PST | | | |
86
88
(5 rows)
87
89
88
90
SELECT count(*) FROM _timescaledb_config.bgw_job WHERE config->>'type' IN ('procedure', 'function');
@@ -230,6 +232,19 @@ SELECT scheduled, config FROM timescaledb_information.jobs WHERE job_id = 1000;
230
232
f | {"test": "test"}
231
233
(1 row)
232
234
235
+ -- test updating the job name
236
+ SELECT job_id, job_name FROM alter_job(1000,job_name:='custom_name_2');
237
+ job_id | job_name
238
+ --------+----------------------
239
+ 1000 | custom_name_2 [1000]
240
+ (1 row)
241
+
242
+ SELECT application_name FROM timescaledb_information.jobs WHERE job_id = 1000;
243
+ application_name
244
+ ----------------------
245
+ custom_name_2 [1000]
246
+ (1 row)
247
+
233
248
-- Done with job 1000 now, so remove it.
234
249
SELECT delete_job(1000);
235
250
delete_job
@@ -906,9 +921,9 @@ update _timescaledb_catalog.chunk set status=3 where table_name = :'new_uncompre
906
921
SELECT add_compression_policy('sensor_data', INTERVAL '1' minute) AS compressjob_id \gset
907
922
-- set recompress to true
908
923
SELECT alter_job(id,config:=jsonb_set(config,'{recompress}', 'true')) FROM _timescaledb_config.bgw_job WHERE id = :compressjob_id;
909
- alter_job
910
- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
911
- (1014,"@ 12 hours","@ 0",-1,"@ 1 hour",t,"{""recompress"": true, ""hypertable_id"": 4, ""compress_after"": ""@ 1 min""}",-infinity,_timescaledb_functions.policy_compression_check,f,,)
924
+ alter_job
925
+ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
926
+ (1014,"@ 12 hours","@ 0",-1,"@ 1 hour",t,"{""recompress"": true, ""hypertable_id"": 4, ""compress_after"": ""@ 1 min""}",-infinity,_timescaledb_functions.policy_compression_check,f,,,"Compression Policy [1014]" )
912
927
(1 row)
913
928
914
929
-- verify that there are other uncompressed new chunks that need to be compressed
0 commit comments