@@ -34,13 +34,22 @@ select -- pg_backend_pid(), -- If we're connecting through pgbouncer, then pr
3434 when epoch < 60.0 then round(extract(second from lag)::numeric, 1) || 's'
3535 when epoch < 3600.0 then round(extract(second from lag)::numeric, 0) || 's'
3636 end
37- ), ''), '?') as replication_lag
37+ ), ''), '?') as replication_lag,
38+ (with t as (
39+ select distinct on (name) *
40+ from pg_file_settings
41+ order by name, seqno desc
42+ )
43+ select count(*)
44+ from t
45+ join pg_settings as s on t.name = s.name
46+ where not applied) as pg_file_settings_error_count
3847from coalesce(case when not pg_is_in_recovery() then null -- not standby
3948 when not exists(select from pg_stat_wal_receiver) then null -- primary lost
4049 when pg_last_wal_receive_lsn() = pg_last_wal_replay_lsn() then '0'::interval -- no lag
4150 else now() - pg_last_xact_replay_timestamp()
4251 end) as r(lag),
43- extract(epoch from lag) as e(epoch)
52+ extract(epoch from r. lag) as e(epoch)
4453\gset
4554
4655/* psql escape codes:
0 commit comments