The fastest way to check your PostgreSQL version

Open a terminal or command prompt and type psql --version, then press Enter. PostgreSQL will print the version number when ready — for example, "psql (PostgreSQL) 14.5" — and you are done. This works on Windows, Mac, and Linux.

If that command does not work, PostgreSQL may not be installed on your computer, or the program is not in your system's search path. The next sections cover what to do in that situation and how to check the version of a PostgreSQL server you are connecting to remotely.

Key Takeaways

  • Type psql --version in your terminal to see the PostgreSQL client version on your computer in seconds.
  • If the command fails, PostgreSQL may not be installed, or you need to add it to your system path — the instructions differ by operating system.
  • To check the version of a PostgreSQL server you are connected to, use the SELECT version(); command inside psql.
  • The client version (psql) and server version (the database itself) can differ, and both numbers matter for compatibility.
  • On Windows, you may need to use the full path to psql, such as C:\Program Files\PostgreSQL\14\bin\psql.exe --version.

Checking the version when psql --version does not work

If you type psql --version and see "command not found" or "is not recognized", PostgreSQL is either not installed or your computer does not know where to find it. On Windows, the installer usually adds PostgreSQL to your path automatically, but on Mac and Linux you may need to do it yourself.

On Mac with Homebrew, type brew list postgresql to confirm it is installed. If it is, type /usr/local/bin/psql --version to use the full path. On Linux, type which psql first — if it returns a path, use that path instead of just typing psql. If which psql returns nothing, PostgreSQL is not installed.

On Windows, open File Explorer and navigate to C:\Program Files\PostgreSQL. Look for a folder with a version number like "14" or "15". Open that folder, then open the bin subfolder inside it. You should see psql.exe. Right-click in the empty space, select "Open PowerShell window here", and type psql.exe --version.

Checking the version of a PostgreSQL server you are connected to

The psql --version command shows you the version of the client — the program on your computer that connects to PostgreSQL. The server — the actual database running somewhere — might be a different version. To check the server version, you need to connect to it first.

Type psql -U postgres (or replace "postgres" with your username) and enter your password when prompted. Once you are inside psql, the prompt will show a # or => symbol. Type SELECT version(); and press Enter. PostgreSQL will print the full server version, including the operating system it is running on.

If you are connecting to a server on another computer, add -h hostname to the command, like psql -U postgres -h 192.168.1.100. Replace the IP address with the actual server address. The server version will still display when you run SELECT version(); inside psql.

Why client and server versions can differ

You can have PostgreSQL 14 installed on your computer but connect to a PostgreSQL 12 server on another machine. Both versions work together in most cases, but some features only exist in newer versions. If you write code that uses a feature from PostgreSQL 15 but your server is version 12, the command will fail.

When you upgrade PostgreSQL on your computer, the client updates automatically. The server — especially one you do not control — may stay on an older version for months or years. Checking both versions tells you what features are actually available to you.

Checking the version in pgAdmin or other tools

If you use pgAdmin (a graphical interface for PostgreSQL) instead of the command line, right-click the server name in the left panel and select "Properties". The version appears in the "Version" field at the top of the window.

In other tools like DBeaver, connect to your server, then open the SQL editor and type SELECT version(); — the same command works everywhere. Some tools also show the version in the connection properties or server information panel without needing to run a query.

What the version number actually means

A PostgreSQL version like "14.5" breaks down as follows: 14 is the major version (the big release), and 5 is the minor version (a smaller update with bug fixes). Major versions introduce new features and sometimes remove old ones. Minor versions fix problems without changing how the software works.

You should update minor versions regularly — going from 14.1 to 14.5 is safe and recommended. Major version upgrades (like 13 to 14) require more planning because they can break older code. Check the PostgreSQL release notes before upgrading a major version, especially if you have applications that depend on it.

Frequently Asked Questions

What if psql is installed but I cannot find the version?

Try typing psql -V (capital V) instead of --version. Both commands do the same thing, but some older PostgreSQL versions only recognize the short form. If neither works, your installation may be corrupted — reinstalling PostgreSQL usually fixes it.

Can I check the version without connecting to the server?

Yes. The psql --version command shows the client version without connecting to anything. To check a server version, you must connect to it first using psql -U username and then run SELECT version(); inside the prompt.

Does the client version have to match the server version?

No. A newer client can usually connect to an older server, and an older client can connect to a newer server. However, some advanced features only work if both are recent enough. If you encounter strange errors, checking both versions is often the first troubleshooting step.

How do I exit psql after checking the version?

Type \q and press Enter. You will return to your regular terminal prompt. On Windows, you can also close the PowerShell window directly.