This message appears when connecting to a PostgreSQL server that is in recovery mode - either recovering from a crash or operating as a hot standby replica.
Impact
Database is read-only during recovery. Write operations are rejected. On standby servers, this is normal and expected.
Common Causes
- Server is hot standby replica
- Crash recovery in progress
- Point-in-time recovery (PITR)
- Standby promotion not complete
Troubleshooting and Resolution Steps
Check if server is standby:
SELECT pg_is_in_recovery(); -- Returns true if in recoveryWait for recovery to complete:
# Watch logs for completion tail -f /var/log/postgresql/postgresql-15-main.logPromote standby if needed:
# Promote standby to primary pg_ctl promote -D /var/lib/postgresql/15/main
Additional Information
- Normal state for read replicas
- Read-only during recovery
- Some operations restricted even with hot_standby
- Monitor recovery progress in logs
Frequently Asked Questions
Q: Can I write to a standby server?
A: No, standby servers are read-only. Write to primary server.
Q: How long does recovery take?
A: Depends on amount of WAL to replay. Minutes to hours for large databases.