Failed to access file "$ libdir / plpgsql": no such file or directory

I am at a loss, I am having problems creating a stored procedure on the local Postgres server (postgres.app, Mac OS X 10.7), since

$ 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 checked the following:

Installed Languages:

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):

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

The file is present:

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

DLSUFFIX is installed correctly:

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

They tried to uninstall and reinstall, but nothing has changed. Any ideas?

+8
source share
2 answers

( ) Postgres ? Postgres . Debian Ubuntu . OS X, .

Postgres $libdir . .
pg_config --pkglibdir, , . :

which pg_config

:

  • 9.3.0? -, 9.3.2. , .

  • , $libdir, , , :

    SELECT * FROM pg_settings WHERE  name ~~* '%lib%';
    
  • 'plpgsql' ( ). : plpgsql.

  • plpgsql :=. = , .
    Postgres 9.4 :=, = .

. :

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

FreeBSD , /usr/local/lib/postgresql/, $ libdir. PostgreSQL , , .

0

All Articles