How to fix this PostgreSQL installation?

I realized that PostgreSQL was already running on my laptop (Mac OS X) before I installed it from the Postgres website. So when I used the installer, I got PostgreSQL and logged in to the postgres account that was created.

In the terminal, I wrote

psql -U postgres 

And provided my password. I logged in, but he said:

WARNING: psql version 9.0, server version 9.1. Some psql functions may not work.

How can I fix this so that I can access the database normally without any problems?

+4
source share
2 answers

The warning comes from psql , the PostgreSQL interactive terminal. Nothing bad will happen.

Since you have two versions of PostgreSQL installed in parallel, you will need two versions of psql. You might even have them on disk. But when you enter the psql , your system will use one of them by default, not knowing in advance which version of the database server you are going to connect to.

You can enter an explicit path to the psql version you need. Find the full path for all options with this shell command (works with Linux, not tested with Mac OS X):

 which -a psql 

If you also did not install the psql version 9.1 with PostgreSQL, you should install it, first of course.
If you are no longer going to use PostgreSQL 9.0, you can remove it for disambiguation.

In Debian, you can also set several alternatives by default with:

 update-alternatives 

But on Debian, you also have a shell that dynamically invokes the corresponding psql if you specify the database cluster as follows:

 psql --cluster 9.1/main 

Not sure about Mac OS X.

+6
source

You have installed postgresql server 9.1 (server side) and postgres (client side 9.0). You may also have installed client 9.1, but it is not in the way, so you need to find it, or if you do not have it, then install it.

0
source

Source: https://habr.com/ru/post/1391566/


All Articles