Skip to content

Commit

Permalink
Fix for pg_stat_wal_receiver: LSNs can be NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdevan committed Jul 19, 2024
1 parent 37d67d3 commit 82fbabf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions collector/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,10 @@ func (c *collector) getWalReceiverv13() {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()

q := `SELECT status, receive_start_lsn, receive_start_tli, written_lsn,
flushed_lsn, received_tli, last_msg_send_time, last_msg_receipt_time,
latest_end_lsn,
q := `SELECT status, receive_start_lsn, receive_start_tli,
COALESCE(written_lsn::text, ''), COALESCE(flushed_lsn::text, ''),
received_tli, last_msg_send_time, last_msg_receipt_time,
COALESCE(latest_end_lsn::text, ''),
COALESCE(EXTRACT(EPOCH FROM latest_end_time)::bigint, 0),
COALESCE(slot_name, ''), conninfo, @sender_host@
FROM pg_stat_wal_receiver`
Expand Down

0 comments on commit 82fbabf

Please sign in to comment.