How Do You Find the Version of Postgres without Running a SQL Command?

Problem scenario
To find the version of Postgres when you can enter the SQL database, you would run this SQL command with no quotes: "SELECT version();"

In this situation you cannot enter the Postgres database (and therefore can run no SQL commands).  You want to know more about the installation of Postgres to troubleshoot why you cannot enter it.  How do you find the version of Postgresql that is installed?

Solution
For Debian/Ubuntu distributions of Linux, run:
dpkg -l | grep postgres

For CentOS/RedHat/Fedora distributions of Linux, run:
rpm -qa | grep postgres

Leave a comment

Your email address will not be published. Required fields are marked *