Re: pg_dump: [archiver (db)] query failed: ERROR: could not access file "$libdir/postgis-2.1": No such file or directory

From: Lucas Possamai <drum(dot)lucas(at)gmail(dot)com>
To: John Kelly <jtkells(at)gmail(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: pg_dump: [archiver (db)] query failed: ERROR: could not access file "$libdir/postgis-2.1": No such file or directory
Date: 2017-02-16 02:53:21
Message-ID: CAE_gQfVfBJGXt0S5vgO7TP+PtnnE=P9cC1zeiDAYz3Uu+RNTWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

2017-02-16 15:45 GMT+13:00 John Kelly <jtkells(at)gmail(dot)com>:

> I am having a problem with a solaris 10 postgresql 9.3 postgis 2.1.3
> system. The origin system crashed and all SW was lost. They moved the
> database files residing on a san to another solaris system 10 that had
> postgresql installed but no postgis. I don’t have permissions to install
> postgis nor do they have all the utilities necessary to build it.
>
> I tried to do a pg_dump so that I can create the database on a intel
> platform where I have permissions. When I do pg_dump it terminates with
>
> pg_dump: [archiver (db)] query failed: ERROR: could not access file
> "$libdir/postgis-2.1": No such file or directory
> pg_dump: [archiver (db)] query was: SELECT a.attnum, a.attname,
> a.atttypmod, a.attstattarget, a.attstorage, t.typstorage, a.attnotnull,
> a.atthasdef, a.attisdropped, a.attlen, a.attalign, a.attislocal,
> pg_catalog.format_type(t.oid,a.atttypmod) AS atttypname,
> array_to_string(a.attoptions, ', ') AS attoptions, CASE WHEN a.attcollation
> <> t.typcollation THEN a.attcollation ELSE 0 END AS attcollation,
> pg_catalog.array_to_string(ARRAY(SELECT pg_catalog.quote_ident(option_name)
> || ' ' || pg_catalog.quote_literal(option_value) FROM
> pg_catalog.pg_options_to_table(attfdwoptions) ORDER BY option_name), E',
> ') AS attfdwoptions FROM pg_catalog.pg_attribute a LEFT JOIN
> pg_catalog.pg_type t ON a.atttypid = t.oid WHERE a.attrelid =
> '6129600'::pg_catalog.oid AND a.attnum > 0::pg_catalog.int2 ORDER BY
> a.attrelid, a.attnum
>
>
> all the object for postgis are in public but postgres doesn’t show the
> extension being installed. How can I get around this problem so I dump
> this database?
> Thanks
>
>
>

Make sure to have that package installed on your OS.
In my case, using Ubuntu-server and PostgreSQL 9.2:

apt-get install -y postgresql-9.2-postgis-2.3

Then, you need to check if the DB has the same version of Postgis[1]:

name | default_version | installed_version

postgis | 2.3.0 | 2.2.0

If not (in my case it didn't have same version), you need to update the DB:

ALTER EXTENSION postgis UPDATE TO "2.3.0"

[1]
https://www.postgresql.org/docs/9.2/static/view-pg-available-extensions.html

Lucas

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Dhandapani Shanmugam 2017-02-17 07:54:12 Re: PostgreSQL on Docker
Previous Message John Kelly 2017-02-16 02:45:29 pg_dump: [archiver (db)] query failed: ERROR: could not access file "$libdir/postgis-2.1": No such file or directory