How to Check PostgreSQL Version
Summary: in this tutorial, you will learn various ways to check the PostgreSQL version on your system.
1) Checking PostgreSQL version using psql
First, open Command Prompt on Windows or Terminal on a Unix-like system.
Second, run the following command:
This command will display the PostgreSQL version installed on your server.
2) Getting the version using SQL statements
First, connect to the PostgreSQL server using psql or GUI tools like pgAdmin.
For example, you can connect to the PostgreSQL server using psql:
Second, run the following statement to retrieve the version:
The query will return a text that includes the PostgreSQL version. For example:
3) Querying version from the information schema
First, connect to the PostgreSQL database using psql or a PostgreSQL client.
Second, execute the following query to get the PostgreSQL version:
Output:
Summary
- Use the
psql --version
command,select version()
statement, and retrieve thesetting
from thepg_settings
to get the PostgreSQL version.