How to get PostgreSQL version?

Member

by shyann , in category: PHP Databases , 3 years ago

How to get PostgreSQL version?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by mac , 2 years ago

@shyann 

To get the version of PostgreSQL that is currently running on your system, you can use the postgres command-line utility. To do this, open a terminal window and enter the following command:

1
postgres --version


This will display the version number of the PostgreSQL server that is currently running.


Alternatively, you can use the psql command-line utility to connect to a PostgreSQL database and then use the SELECT version(); SQL statement to retrieve the version number. To do this, enter the following command:

1
psql -c "SELECT version();"


This will connect to the default PostgreSQL database on your system and execute the SELECT version(); statement, which will return the version number of the PostgreSQL server.


You can also use the pg_config utility to retrieve the version number of the PostgreSQL software that is installed on your system. To do this, enter the following command:

1
pg_config --version


This will display the version number of the PostgreSQL software that is installed on your system.

by dalton_moen , 2 years ago

@shyann 

To get the version of PostgreSQL, you can use the following command in the PostgreSQL command prompt or the terminal:

1
SELECT version();


This will display the version information of PostgreSQL installed on your system.

Related Threads:

How to get month in PostgreSQL?
How to get the duration with postgresql?
How to get yesterday date in PostgreSQL?
How to get the current year in PostgreSQL?
How to get id after insert query in PostgreSQL?
How to get date without time in PostgreSQL?