To check the PostgreSQL version installed on your system, you can use the pg_config command or query the version() function in PostgreSQL. I’ll provide examples for both methods.

Using pg_config:

Open a terminal and run the following command:

pg_config --version

This will display the PostgreSQL version installed on your system.

Using SQL query:

If you have access to a PostgreSQL database, you can use the following SQL query:

SELECT version();

Here’s an example using the psql command-line tool:

psql -U your_username -d your_database -c "SELECT version();"

Replace your_username with your PostgreSQL username and your_database with the name of the database you want to connect to. You’ll be prompted to enter your password.

Example Output:

The output for both methods will look similar to this:

PostgreSQL X.X.X on x86_64-pc-linux-gnu, compiled by gcc (GCC) X.X.X, 64-bit

Replace X.X.X with the actual version number.

Choose the method that suits your needs based on whether you want to check the version of the PostgreSQL server on your system or a specific database.

Categories: PostgreSQL


Leave a Reply

Avatar placeholder

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