rajesh
rajesh

Reputation: 3407

PostgreSQL issue: could not access file "$libdir/plpgsql": No such file or directory

I get this exception in PostgreSQL:

org.postgresql.util.PSQLException: ERROR: could not access file "$libdir/plpgsql": No such file or directory
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1721)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1489)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:193)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
    at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:205)

I searched a lot and most solution points to a wrong installation. But this is my test db which has been running without issues for a long time. Also inserts are working. Issue occurs only on select queries.

Upvotes: 7

Views: 13110

Answers (3)

user3196364
user3196364

Reputation: 11

the other instance can sometimes be removed from the system while still running (e.g. you do a gentoo update and a depclean without stopping and migrating your data). so the error seems particularly mysterious.

the solution is usually going to be doing a slot install/eselect of the old version (in gentoo terms, or simply downgrading on other distros), running its pg_dumpall, and then uninstalling/reinstalling the new version and importing the data.

this worked pretty painlessly for me

Upvotes: 0

Joey Adams
Joey Adams

Reputation: 43380

Apparently, you moved your PostgreSQL lib directory out of place. To confirm this, try the following in psql:

> SET client_encoding TO iso88591;
ERROR:  could not access file "$libdir/utf8_and_iso8859_1": No such file or directory

If you get an error message like this, then my theory is correct. You'll need to find out where those files ended up, or you can reinstall PostgreSQL to restore them.

To find out what $libdir is referring to, run the following command:

pg_config --pkglibdir

For me, this produces:

/usr/lib/postgresql

Upvotes: 7

user1410433
user1410433

Reputation: 21

I have the same problem: the other postgres server instance (8.4) was interfering with the 9.1 one; when the 8.4 instance is removed it works.

Upvotes: 2

Related Questions