Hi Wang,
> 6.a
>
> It seems that the upper line represents the apply background worker, but I think
> last_msg_send_time and last_msg_receipt_time should be null.
> Is it like initialization mistake?
I checked again about the issue.
Attributes worker->last_send_time, worker->last_recv_time, and worker->reply_time
are initialized in logicalrep_worker_launch():
```
...
TIMESTAMP_NOBEGIN(worker->last_send_time);
TIMESTAMP_NOBEGIN(worker->last_recv_time);
worker->reply_lsn = InvalidXLogRecPtr;
TIMESTAMP_NOBEGIN(worker->reply_time);
...
```
And the macro is defined in timestamp.h, and it seems that the values are initialized as PG_INT64_MIN.
```
#define DT_NOBEGIN PG_INT64_MIN
#define DT_NOEND PG_INT64_MAX
#define TIMESTAMP_NOBEGIN(j) \
do {(j) = DT_NOBEGIN;} while (0)
```
However, in pg_stat_get_subscription(), these values are regarded as null if they are zero.
```
if (worker.last_send_time == 0)
nulls[4] = true;
else
values[4] = TimestampTzGetDatum(worker.last_send_time);
if (worker.last_recv_time == 0)
nulls[5] = true;
else
values[5] = TimestampTzGetDatum(worker.last_recv_time);
```
I think above lines are wrong, these values should be compared with PG_INT64_MIN.
Best Regards,
Hayato Kuroda
FUJITSU LIMITED