How to check if hot standby serves read-only queries
You can use pg_is_in_recovery()
which returns True
if recovery is still in progress(so the server is running in standby mode). Check the System Administration Functions for further informations.
=# SELECT pg_is_in_recovery(); pg_is_in_recovery─────────────────── f(1 row)