You can check the version of PostgreSQL you are running using the psql
command-line utility or by querying the database system tables. Here's how you can do it:
Using the psql
Command:
Open your terminal or command prompt.
Log in to the PostgreSQL database server using the
psql
command and your database credentials. For example:bash
psql -U your_username -d your_database_name
Replace your_username
with your PostgreSQL username and your_database_name
with the name of your database.
After successfully logging in, you can check the PostgreSQL version by running the following SQL query:
sql
SELECT version();
For example:
sql
your_database_name=# SELECT version(); version ------------------------------------------------------------------------ PostgreSQL 13.3 (Ubuntu 13.3-1.pgdg20.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit (1 row)
This query will return a result showing the PostgreSQL version and some additional information.
Using SQL Query:
If you have access to a PostgreSQL client, you can also query the pg_stat_version
system view to get the version information:
sql
SELECT * FROM pg_stat_version;
This query will return a row with version-related information, including the PostgreSQL version number.
These methods will help you determine the version of PostgreSQL that is currently running on your system.
Comments
Post a Comment