简体   繁体   English

无法访问文件“$libdir/plpgsql”:没有那个文件或目录

[英]Could not access file “$libdir/plpgsql”: No such file or directory

I'm at a loss, I'm having issues creating a stored proc in my local Postgres server (postgres.app, Mac OS X 10.7), as so我不知所措,我在本地 Postgres 服务器(postgres.app,Mac OS X 10.7)中创建存储过程时遇到问题,因此

$ psql
psql (9.3.0)
Type "help" for help.

dchaston=# CREATE OR REPLACE FUNCTION table_update()
dchaston-# RETURNS TRIGGER AS $$
dchaston$# BEGIN
dchaston$#   NEW.last_edit = now();
dchaston$#   RETURN NEW;
dchaston$# END;
dchaston$# $$ language 'plpgsql';
ERROR:  could not access file "$libdir/plpgsql": No such file or directory

I've checked the following:我检查了以下内容:

Languages installed:安装的语言:

dchaston=# select * from pg_language;
lanname  | lanowner | lanispl | lanpltrusted | lanplcallfoid | laninline | lanvalidator | lanacl
---------+----------+---------+--------------+---------------+-----------+--------------+--------
internal |       10 | f       | f            |             0 |         0 |         2246 | 
c        |       10 | f       | f            |             0 |         0 |         2247 | 
sql      |       10 | f       | t            |             0 |         0 |         2248 | 
plpgsql  |       10 | t       | t            |         12019 |     12020 |        12021 | 
(4 rows)

lib directory (and pkglibdir just in case): lib 目录(和 pkglibdir 以防万一):

$ pg_config --libdir
/Applications/Postgres.app/Contents/MacOS/lib
$ pg_config --pkglibdir
/Applications/Postgres.app/Contents/MacOS/lib

File present:文件存在:

$ cd /Applications/Postgres.app/Contents/MacOS/lib; ls plpg*
plpgsql.so

DLSUFFIX set correctly: DLSUFFIX 设置正确:

lib/pgxs/src/Makefile.shlib:135:    DLSUFFIX        = .so

Have tried uninstalling and reinstalling, but made no difference.已尝试卸载并重新安装,但没有任何区别。 Any ideas?有任何想法吗?

Did you install multiple instances (multiple versions or multiple instances of the same version) of Postgres on the same box?您是否在同一个机器上安装了多个Postgres实例(多个版本或同一版本的多个实例)? Standard Postgres is not fit for that.标准 Postgres 不适合这种情况。 Debian or Ubuntu have additional infrastructure to allow multiple versions in parallel. Debian 或 Ubuntu 有额外的基础设施来允许多个版本并行运行。 I don't know about OS X, though.不过,我不知道 OS X。

In standard Postgres the path for $libdir is compiled into the program.在标准 Postgres 中$libdir被编译到程序中。 Multiple versions do not get along.多个版本不相处。
When you execute pg_config --pkglibdir , make sure it's the one associated with your installation.当您执行pg_config --pkglibdir ,请确保它与您的安装相关联。 Run:跑步:

which pg_config

Minor notes:小注:

Otherwise your function definition is fine.否则你的函数定义很好。 That's not the root of the problem:不是问题的根源:

CREATE OR REPLACE FUNCTION table_update()
  RETURNS trigger AS
$func$
BEGIN
   NEW.last_edit := now();
   RETURN NEW;
END
$func$  LANGUAGE plpgsql;

This one is related to the accepted answer .这个与接受的答案有关

I started getting the problem with libdir on MacOS Catalina 10.15.7 while doing the brew update as the brew update failed in between and I noticed that Postgresql was one of the many packages that it was trying to update and the above answer provided a good hint about multiple installations.在进行 brew 更新时,我开始在 MacOS Catalina 10.15.7 上遇到 libdir 问题,因为 brew 更新在两者之间失败,我注意到 Postgresql 是它尝试更新的众多软件包之一,上面的答案提供了一个很好的提示关于多个安装。

I verified that there weren't any additional versions of postgresql installed on my system.我确认我的系统上没有安装任何其他版本的 postgresql。 So a simple restart of the service did the trick for me: brew services restart postgresql@10所以一个简单的服务重启对我brew services restart postgresql@10brew services restart postgresql@10

I use FreeBSD and found a simple way to solve the problem, just copied the library from another server and pasted it into /usr/local/lib/postgresql/, which is the way $libdir.我用的是FreeBSD,找到了一个简单的方法来解决这个问题,直接从另一台服务器上复制库,粘贴到/usr/local/lib/postgresql/中,就是$libdir的方式。 Although the versions of PostgreSQL are different, everything is working and I had no problems again.虽然 PostgreSQL 的版本不同,但一切正常,我再次没有问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PostgreSQL问题:无法访问文件“$ libdir / plpgsql”:没有这样的文件或目录 - PostgreSQL issue: could not access file “$libdir/plpgsql”: No such file or directory 创建template_postgis时无法访问文件“$ libdir / plpgsql” - could not access file “$libdir/plpgsql” while creating template_postgis 错误无法访问文件“ $ libdir / repmgr_funcs”没有此类文件或目录 - ERROR could not access file “$libdir/repmgr_funcs” No such file or directory 无法加载库“$libdir/repmgr_funcs”:错误:无法访问文件“$libdir/repmgr_funcs”:没有这样的文件或目录 - could not load library “$libdir/repmgr_funcs”: ERROR: could not access file “$libdir/repmgr_funcs”: No such file or directory PostgreSQL 12 和 PostGIS 3.0.1:错误:无法访问文件“$libdir/postgis-3”:Linux 上没有此类文件或目录 - PostgreSQL 12 and PostGIS 3.0.1: ERROR: could not access file "$libdir/postgis-3": No such file or directory on Linux GeoDjango设置:错误:无法访问文件“ $ libdir / postgis-1.5”:没有此类文件或目录 - GeoDjango setup: ERROR: could not access file “$libdir/postgis-1.5”: No such file or directory (Postgres)错误:无法访问文件“$libdir/uuid-ossp”:没有这样的文件或目录 - (Postgres) ERROR: could not access file “$libdir/uuid-ossp”: No such file or directory 升级 postgres 数据库文件失败,显示“无法访问文件 $libdir/postgis-2.5:没有这样的文件或目录” - Upgrading postgres database files fail with "could not access file $libdir/postgis-2.5: No such file or directory" 为 Postgres 11 创建扩展导致“无法访问文件 $libdir/...” - Create extension for Postgres 11 results in "could not access file $libdir/..." 错误:无法访问文件“ $ libdir / postgis-2.0” postgresapp - ERROR: could not access file “$libdir/postgis-2.0” postgresapp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM