https://www.niwi.nz/2013/02/16/replication-status-in-postgresql/
select client_addr, state, sent_location, write_location,
flush_location, replay_location from pg_stat_replication;
This query can output can be like this:
postgres=# select client_addr, state, sent_location,write_location, flush_location, replay_location, sync_priority from pg_stat_replication;