Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I correct the mismatch of psql version and postgresql version?

Tags:

postgresql

Somewhere along the line I have ended up with a version mismatch between postgresql-9.4 and psql which is version 9.3 despite the fact that version 9.4 is installed. I think I need to correct the $PATH variable but I don't know where to find this. I've looked in my /etc/.bashrc file and can't see anything that points me in the right direction.

When I do sudo find / -name psql the result is:

/usr/bin/psql
/usr/share/bash-completion/completions/psql
/usr/pgsql-9.4/bin/psql

yum list installed | grep postgres yields the following:

postgresql.x86_64                9.3.9-1.fc21                          @updates 
postgresql-contrib.x86_64        9.3.9-1.fc21                          @updates 
postgresql-devel.x86_64          9.3.9-1.fc21                          @updates 
postgresql-libs.x86_64           9.3.9-1.fc21                          @updates 
postgresql-server.x86_64         9.3.9-1.fc21                          @updates 
postgresql94.x86_64              9.4.5-1PGDG.f21                       @pgdg94  
postgresql94-libs.x86_64         9.4.5-1PGDG.f21                       @pgdg94  
postgresql94-server.x86_64       9.4.5-1PGDG.f21                       @pgdg94 
like image 585
fatherdamo Avatar asked Dec 02 '15 20:12

fatherdamo


1 Answers

As Craig Ringer answered - generally you should use:

sudo update-alternatives --config pgsql-psql

Nevertheless, sometimes you can get such message back:

failed to link /usr/bin/psql -> /etc/alternatives/pgsql-psql: /usr/bin/psql exists and it is not a symlink

If so - try:

ln -s /usr/pgsql-[PUT YOUR VERSION HERE(ex. 9.6)]/bin/psql /usr/local/bin/psql
like image 181
Alexander Gorg Avatar answered Sep 17 '22 19:09

Alexander Gorg