Last active
July 28, 2023 09:36
-
-
Save almog-barel/af21dea9654872f920c29ff87076ee14 to your computer and use it in GitHub Desktop.
postgres get replication status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select case WHEN EXISTS (SELECT * FROM pg_stat_replication) THEN (SELECT CASE WHEN state = 'streaming' THEN true ELSE false END FROM pg_stat_replication LIMIT 1) WHEN pg_is_in_recovery() THEN (SELECT CASE WHEN status = 'streaming' THEN true ELSE false END FROM pg_stat_wal_receiver LIMIT 1) ELSE true END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment