DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Client Connection Defaults / Other Defaults

dynamic_library_path

Sets the path for dynamically loadable modules. If a dynamically loadable module needs to be opened and the specified name does not have a directory component (i.e., the name does not contain a slash), the system will search this path for the specified file.

  • Default: $libdir
  • Type: string
  • Applies: Session (superuser)

In plain words

When PostgreSQL needs to load a compiled module (for an extension, LOAD, or a C function) and only knows its name, it looks for the file in these directories, in order. The default $libdir is PostgreSQL's own library folder.

For DBAs and operators

A colon-separated list of absolute directories (semicolons on Windows). $libdir expands to the compiled-in package library directory (pg_config --pkglibdir, for example /usr/lib/postgresql/18/lib). An empty value turns off the path search, so only absolute names work. The search is used only when the name has no slash; the platform suffix (.so) is added automatically if missing.

It is used by LOAD, CREATE FUNCTION … LANGUAGE C with '$libdir/x'-less names, and the preload settings. Setting it per session is possible for superusers but intended for development; put it in postgresql.conf.

New in PostgreSQL 18 is the matching extension_control_path; if you install extensions outside the standard tree, set both, for example dynamic_library_path = '/opt/ext/lib:$libdir'. Failure looks like ERROR: could not access file "nosuchlib": No such file or directory

How to change it

A superuser (or a role granted SET) can change it per session with SET.

Related parameters

extension_control_path shared_preload_libraries session_preload_libraries

All Client Connection Defaults parameters