@@ -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_overflow": 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');
@@ -164,6 +166,8 @@ SELECT alter_job(NULL, if_exists => false);
164
166
ERROR: job ID cannot be NULL
165
167
SELECT alter_job(-1, if_exists => false);
166
168
ERROR: job -1 not found
169
+ SELECT alter_job(1000, job_name => 'this_is_a_really_really_really_long_application_name_to_overflow');
170
+ ERROR: application name "this_is_a_really_really_really_long_application_name_to_overflow [1000]": too long.
167
171
\set ON_ERROR_STOP 1
168
172
-- test bad input but don't fail
169
173
SELECT alter_job(NULL, if_exists => true);
@@ -230,6 +234,19 @@ SELECT scheduled, config FROM timescaledb_information.jobs WHERE job_id = 1000;
230
234
f | {"test": "test"}
231
235
(1 row)
232
236
237
+ -- test updating the job name
238
+ SELECT job_id, application_name FROM alter_job(1000,job_name:='custom_name_2');
239
+ job_id | application_name
240
+ --------+----------------------
241
+ 1000 | custom_name_2 [1000]
242
+ (1 row)
243
+
244
+ SELECT application_name FROM timescaledb_information.jobs WHERE job_id = 1000;
245
+ application_name
246
+ ----------------------
247
+ custom_name_2 [1000]
248
+ (1 row)
249
+
233
250
-- Done with job 1000 now, so remove it.
234
251
SELECT delete_job(1000);
235
252
delete_job
@@ -906,9 +923,9 @@ update _timescaledb_catalog.chunk set status=3 where table_name = :'new_uncompre
906
923
SELECT add_compression_policy('sensor_data', INTERVAL '1' minute) AS compressjob_id \gset
907
924
-- set recompress to true
908
925
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,,)
926
+ alter_job
927
+ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
928
+ (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
929
(1 row)
913
930
914
931
-- verify that there are other uncompressed new chunks that need to be compressed
0 commit comments