Postgresql – Difficulty with Postgis extension on Ubuntu 14.04

postgispostgresqlUbuntu

I have a updated Ubuntu 14.04 running postgresql 9.3 (installed using the tutorial from https://wiki.postgresql.org/wiki/Apt).

When I access my database through pgadmin and go to the console and type:

-"create extension postgis;"

I get an error that the extension is missing in the directory:

 /usr/share/postgresql/9.1/extension/postgis.control

But that is 9.1. – Is pgadmin connected to the wrong postgresql? In my postgresql directory I also have a folder "9.1", "9.2" and "9.3". And the postgis extension files seem to only be in the 9.3 subfolder.

Do I need to change something in the pgadmin settings? I kind of ran out of options myself.

Packages:

  • postgis 2.1.2+dfsg-2
  • postgresql-9.3-postgis2.1
  • postgresql 9.3+154.pgdg14.04+1
  • pgadmin3 1.18.1-2
  • postgresql-contrib-9.3

Edit:

 dpkg -L postgresql-9.3-postgis2.1

returns:

 dpkg-query: Package »postgresql-9.3-postgis2.1« is not installed.

but this worked

 sudo dpkg -L postgresql-9.3-postgis-2.1 2.1.2+dfsg-2

    /.
    /usr
    /usr/lib
    /usr/lib/postgresql
    /usr/lib/postgresql/9.3
    /usr/lib/postgresql/9.3/lib
    /usr/lib/postgresql/9.3/lib/postgis-2.1.so
    /usr/lib/postgresql/9.3/lib/rtpostgis-2.1.so
    /usr/share
    /usr/share/doc
    /usr/share/doc/postgresql-9.3-postgis-2.1
    /usr/share/doc/postgresql-9.3-postgis-2.1/copyright
    /usr/share/doc/postgresql-9.3-postgis-2.1/changelog.Debian.gz

Edit 2:

The server status is also complaining about "The server lacks instrumentation functions" and the missing conbrib-package. Here too the installed package "postgresql-contrib-9.3" is ignored.

enter image description here

Edit 3:

Output of "pg_lsclusters"

    Ver Cluster Port Status Owner    Data directory               Log file
    9.1 main    5432 online postgres /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log
    9.3 main    5433 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

Best Answer

But that is 9.1. - Is pgadmin connected to the wrong postgresql?

Yes.

It appears that you're connected to your 9.1 server, suggesting that 9.1 is still running.

Do pg_lsclusters to see what PostgreSQL installs you have and their status.

Each runs on a different port. If you want to connect to 9.3 you need to check what port it runs on and connect PgAdmin to that port.