psql indicates different server version
Asked Answered
N

1

8

Today I was prompted to upgrade my OS from Ubuntu 14.04 LTS to 16.04 LTS. Generally speaking, it went smoothly. However, I did receive error messages indicating that the upgrade of PostgreSQL from 9.3 to 9.5 did not succeed. I eventually was able to install postgresql-9.5 and have verified that I see my previously created databases and tables.

However, when I use the psql command to access a database called hierarchy as follows, I get some unfamiliar output:

$ psql hierarchy jkeenan
psql (9.5.3, server 9.3.13)
Type "help" for help.

Does this indicate that part of my PostgreSQL setup (broadly speaking) was not upgraded to 9.5?

Update: Once inside psql I can say SELECT version(); and get this output:

 PostgreSQL 9.3.13 on x86_64-unknown-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.1) 4.8.4, 64-bit

How would I perform this upgrade? Is the difference between the psql version and the "server" version something I should be concerned about?

Other data which might be helpful in diagnosis:

$ createdb --version
createdb (PostgreSQL) 9.5.3
$ psql --version
psql (PostgreSQL) 9.5.3

Thank you very much.

Nu answered 1/8, 2016 at 3:16 Comment(3)
Yes, it proved very helpful. For reference, here are the points where there was some confusion. 1. In the older, 9.3 installation, in pg_hba.conf, I had: local all postgres md5 (for reasons I can't recall right now). I had to switch that back to local all postgres peer to proceed. 2. After sudo su postgres, you have to switch to a directory writable by user postgres. See #23217234. 3. I had to use ` line separators when pasting the pg_upgrade` command.Nu
@LaurenzAlbe link in your comment is not accessible. Could you provide the correct link?Swope
@Swope I don't know if that very blog still exists. Essentially, you either have to dump the cluster and restore it into the higher version, or you have to run pg_upgrade. I recommend the PostgreSQL documentation.Cyclostyle
P
0

I'm almost ten years late, but I had the same problem today. The installation of the new version went smoothly, so that wasn't the problem. In my case it turned out that I had just the old server still active, stopping it and starting the new one fixed the issue. In Ubuntu this can be done by:

    systemctl stop postgresql@14

then start the server of your new version of PostgreSQL.

In OS, I used:

    brew services stop postgresql@14

Then started my new one with:

    brew services start postgresql@16
Pleonasm answered 29/8, 2024 at 17:17 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.