Hello lad
Hello lad

Reputation: 18790

PostgreSQL version incompability

The situation is the following:

I have install the postgresql-9.3 with command

    sudo apt-get install postgresql-9.3:

and then use pg_ctl to start the server

    pg_ctl -D /var/lib/postgresql/9.3/main -Z coordinator start

which causes following error:

    18:23:50 CEST FATAL:  database files are incompatible with server 2014-07-14 18:23:50 CEST DETAIL:  The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.2.4.

I have no idea where comes the version 9.2.4, I have checked all my folders about Postgres, they all under folder 9.3 and even tried pg_clusters. Can anyone give some hints to fix this?

dpkg -l | grep postgres gives the result:

ii  postgres-xc               1.1-2ubuntu2  amd64        write-scalable, synchronous multi-master, transparent PostgreSQL cluster
ii  postgres-xc-client        1.1-2ubuntu2  amd64        front-end programs for Postgres-XC
rc  postgresql-9.3            9.3.4-1       amd64        object-relational SQL database, version 9.3 server
rc  postgresql-client-common  154           all          manager for multiple PostgreSQL client versions
rc  postgresql-common         154           all          PostgreSQL database-cluster manager

I have tried once to delete "everything", and reinstall them again now I have the output of dpkg -l | grep` postgres:

    ii  postgresql-9.3        9.3.4-1       amd64        object-relational SQL database, version 9.3 server
    ii  postgresql-client-9.3 9.3.4-1       amd64        front-end programs for PostgreSQL 9.3
    ii  postgresql-client-common  154       all          manager for multiple PostgreSQL client versions
    ii  postgresql-common         154       all          PostgreSQL database-cluster manager

now everything looks fine, when I try to start the server with pg_ctl the command line tells me:

    The program 'pg_ctl' is currently not installed. You can install it by typing:

sudo apt-get install postgres-xc

Is there any other way to start the server? Should I install postgres-xc following the advise?

Thank you

Upvotes: 0

Views: 1025

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656221

There is an old Postgres 9.2 installation on your machine (unless you are not confusing two machines). Assuming Debian for lack of information. Ubuntu should be similar.

Check with

dpkg -l | grep postgres

(Unless you are installing programs without the package manager as well, then you should also be able to untangle this mess.)

If you don't need Postgres 9.2 any more (make sure of that!) uninstall it. Then everything should work just fine.

sudo apt-get remove postgresql-9.2

Or even:

sudo apt-get purge postgresql-9.2

If you want to keep both (or more) versions in parallel, I suggest you install postgresql-common and postgresql-client-common additionally, which helps to make this possible.

Upvotes: 1

Related Questions