How to manage different versions of postgresql on Ubuntu

Basically, when I run psql --version, I get PostgreSQL 9.5.4. But with sudo su postgres and psql, the terminal throws me psql (10.0). Could anyone tell me what exactly going on here?

What makes me more confused is that there's no ./9.5 under the directory /etc/postgresql/. The only version I manually installed on my machine is postgresql-10, and I have no clue why "9.5" pops up when I run psql --version

And if I had multiple postgresql (i.e. postgresql-9.5, postgresql-9.6) installed, what is the correct way to use a certain version of postgresql?

3

1 Answer

When you are getting the PostgreSQL 9.5.4 when using psql --version, try to locate the path of psql using either of these which psql or locate psql.

You should be able to see which installation of postgres is providing the output.

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like