Show PostgreSQL server version and recovery state
Build a paste-ready command, then review its compatibility and effects before running it.
psql -d <database> -Atc "select version(), pg_is_in_recovery();"Complete required fields to copy the generated command.
Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementspsqlpsql must be installed and available on PATH.Network accessThe target must be reachable from the current environment.
Version supportpsql Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsPostgreSQL 18.0 on x86_64-pc-linux-gnu, compiled by gcc, 64-bit|fRepresentative successful output; values vary with the selected target and system state.
Known errorspsql: command not foundpsql is missing or is not available on PATH.
Verifypsql -d {{database}} -Atc "select version(), pg_is_in_recovery();"The output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01psqlCommandRuns the psql stage of this one-liner.
02-dOptionConfigures psql with the -d option.
03<database>ParameterA value supplied in the Fill parameters section.
04-AtcOptionConfigures psql with the -Atc option.
05"select version(), pg_is_in_recovery();"ArgumentPasses "select version(), pg_is_in_recovery();" to psql.
Example input
psql -d appdb -Atc "select version(), pg_is_in_recovery();"
Example output
PostgreSQL 18.0 on x86_64-pc-linux-gnu, compiled by gcc, 64-bit|f
Illustrative output — exact values vary by system and data.
Official sources