PostgreSQL 问题:无法访问文件“$libdir/plpgsql”:没有那个文件或目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6874164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PostgreSQL issue: could not access file "$libdir/plpgsql": No such file or directory
提问by rajesh
I get this exception in PostgreSQL:
我在 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.
我搜索了很多,大多数解决方案都指向错误的安装。但这是我的测试数据库,它已经运行了很长时间没有问题。也插入工作。问题仅发生在选择查询上。
回答by Joey Adams
Apparently, you moved your PostgreSQL lib directory out of place. To confirm this, try the following in psql:
显然,您将 PostgreSQL lib 目录移到了不合适的位置。要确认这一点,请在 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.
如果你收到这样的错误信息,那么我的理论是正确的。您需要找出这些文件的最终位置,或者您可以重新安装 PostgreSQL 以恢复它们。
To find out what $libdir
is referring to, run the following command:
要找出$libdir
所指的内容,请运行以下命令:
pg_config --pkglibdir
For me, this produces:
对我来说,这会产生:
/usr/lib/postgresql
回答by user1410433
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.
我有同样的问题:另一个 postgres 服务器实例(8.4)正在干扰 9.1 的;当 8.4 实例被删除时,它可以工作。
回答by user3196364
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.
另一个实例有时可以在仍在运行时从系统中删除(例如,您在不停止和迁移数据的情况下执行 gentoo 更新和 depclean)。所以这个错误似乎特别神秘。
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.
解决方案通常是对旧版本进行插槽安装/eselect(用gentoo术语,或者只是在其他发行版上降级),运行其pg_dumpall,然后卸载/重新安装新版本并导入数据。
this worked pretty painlessly for me
这对我来说非常轻松