0

I have installed postgres 9.6, If you type in terminal psql -V or psql --version, you know which postgresql version you have installed, however, if you type sudo apt-cache policy postgresql, it appears that you do not have installed postgresql and that the candidate is postgresql 10.

Do you know why this last command does not recognize postgres 9.6 install and which is the difference?

Thanks is advance

4
  • 1
    How did you install postgres 9.6? What is your Ubuntu version? Jul 4, 2018 at 20:36
  • apt-cache looks at actual package containing an app and things, it doesn't search by "app name". Package names often have a version attached to it. So try apt-cache policy postgresql9 or postgresql9.6 Jul 4, 2018 at 20:41
  • @steeldriver, I did it with sudo apt-get install postgresql-9.6, I had a problem installing this specific version with 18.04, I asked to the community, I found the solution, removing completety the postgres 10 In this link you can check the steps in case you have a similar issue. askubuntu.com/questions/1052079/… Jul 5, 2018 at 7:35
  • @SergiyKolodyazhnyy thanks for your time, however, I have a message "unable to locate package posgresql9 or 9.6" when typing the command. Jul 5, 2018 at 7:36

1 Answer 1

1

As has been mentioned in the comments, apt-cache policy <package name> asks apt-get to shows the package information, while psql -V makes the postgres itself report the version. So postgresql-9.6 is the package that contains the actual app and related files, among which psql. Either one is valid, but in case of apt-cache you need to provide the name of the actual package you've installed, while app or command might be different as in psql case.

As mentioned in the comments as well, you've installed the package as sudo apt-get install postgresql-9.6, and same name should be used with apt-cache policy:

$ apt-cache policy postgresql-9.6
postgresql-9.6:
  Installed: 9.6.3-4+b1
  Candidate: 9.6.3-4+b1
  Version table:
 *** 9.6.3-4+b1 500
<removed sources>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .