Configuration parameter

dynamic_library_path — PostgreSQL configuration parameter

Category Client Connection Defaults

If a dynamically loadable module needs to be opened and the file name specified in the CREATE FUNCTION or LOAD command does not have a directory component (i.e., the name does not contain a slash), the system will search this path for the required file.

At a glance

Property Value
Parameter dynamic_library_path
Category Client Connection Defaults
Default (see documentation)
Value type string
Change scope Per-session (SET)
Available in PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12)

What it does

If a dynamically loadable module needs to be opened and the file name specified in the CREATE FUNCTION or LOAD command does not have a directory component (i.e., the name does not contain a slash), the system will search this path for the required file.

The value for dynamic_library_path must be a list of absolute directory paths separated by colons (or semi-colons on Windows). If a list element starts with the special string $libdir, the compiled-in PostgreSQL package library directory is substituted for $libdir; this is where the modules provided by the standard PostgreSQL distribution are installed. (Use pg_config –pkglibdir to find out the name of this directory.) For example: dynamic_library_path = ‘/usr/local/lib/postgresql:/home/my_project/lib:$libdir’ or, in a Windows environment: dynamic_library_path = ‘C:\tools\postgresql;H:\my_project\lib;$libdir’

(Description quoted from the official PostgreSQL documentation.)

How to apply a change

Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.

Inspect the current value and source with SHOW dynamic_library_path; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'dynamic_library_path';.

Tuning guidance

This sets a session default (locale, formatting, search path or transaction behaviour) rather than a performance knob. Set it per role or database with ALTER ROLE/DATABASE ... SET so the right default follows the right workload, and prefer setting it explicitly in the application for behaviour the query results depend on.

Reference

PostgreSQL documentation — dynamic_library_path.

Keep going

Related & next steps

Was this helpful?

← All configuration parameters