Skip to content

Commit 4eabe6d

Browse files
committed
Fix initial_start handling in build_job_info
1 parent e996a2d commit 4eabe6d

5 files changed

Lines changed: 14 additions & 2 deletions

File tree

.unreleased/pr_10199

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes: #10199 Fix initial_start handling in build_job_info

src/bgw/job.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ job_config_check(BgwJob *job, Jsonb *config)
160160

161161
/* Both should either be empty or contain a schema and name */
162162
Assert((strlen(NameStr(job->fd.check_schema)) == 0) ==
163-
(strlen(NameStr(job->fd.check_schema)) == 0));
163+
(strlen(NameStr(job->fd.check_name)) == 0));
164164

165165
/* If there is no function, just return */
166166
if (strlen(NameStr(job->fd.check_name)) == 0)

src/bgw/job_stat_history.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ build_job_info(BgwJob *job)
4343

4444
if (job->fd.initial_start)
4545
{
46-
ts_jsonb_add_interval(&parse_state, "initial_start", &job->fd.retry_period);
46+
ts_jsonb_add_timestamptz(&parse_state, "initial_start", job->fd.initial_start);
4747
}
4848

4949
if (job->fd.hypertable_id != INVALID_HYPERTABLE_ID)

src/jsonb_utils.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,15 @@ ts_jsonb_add_interval(JsonbInState *state, const char *key, Interval *interval)
176176
ts_jsonb_add_value(state, key, &json_value);
177177
}
178178

179+
void
180+
ts_jsonb_add_timestamptz(JsonbInState *state, const char *key, const TimestampTz value)
181+
{
182+
JsonbValue json_value;
183+
184+
ts_jsonb_set_value_by_type(&json_value, TIMESTAMPTZOID, TimestampTzGetDatum(value));
185+
ts_jsonb_add_value(state, key, &json_value);
186+
}
187+
179188
void
180189
ts_jsonb_add_value(JsonbInState *state, const char *key, JsonbValue *value)
181190
{

src/jsonb_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ extern TSDLLEXPORT void ts_jsonb_add_str_array(JsonbInState *state, const char *
1919
const char **values, int num_values);
2020
extern TSDLLEXPORT void ts_jsonb_add_interval(JsonbInState *state, const char *key,
2121
Interval *interval);
22+
extern TSDLLEXPORT void ts_jsonb_add_timestamptz(JsonbInState *state, const char *key,
23+
const TimestampTz value);
2224
extern TSDLLEXPORT void ts_jsonb_add_int32(JsonbInState *state, const char *key, const int32 value);
2325
extern TSDLLEXPORT void ts_jsonb_add_int64(JsonbInState *state, const char *key, const int64 value);
2426
extern TSDLLEXPORT void ts_jsonb_set_value_by_type(JsonbValue *value, Oid typeid, Datum datum);

0 commit comments

Comments
 (0)