include

A configuration file directive specifying the name of a configuration file to include

include is a configuration file directive specifying the name of another configuration file to include.

include was added in PostgreSQL 8.2.

Usage

The specified file can be either relative to the current configuration file, or an absolute file path.

If the specified file does not exist, reloading the PostgreSQL configuration on a running server will fail and the existing configuration will be retained. If an attempt is made to start or restart the server, the operation will fail. Use include_if_exists to ensure a missing configuration file does not result in this kind of error.

Change history

Examples

Example usage in postgresql.conf:

# server-specific configuration files

include 'postgresql.replication.conf'
include 'postgresql.local.conf'

If the specified file does not exist, an entry similar to the following will be emitted in the log when the configuration is reloaded:

[2022-08-02 12:19:59 UTC]    LOG:  00000: received SIGHUP, reloading configuration files
[2022-08-02 12:19:59 UTC]    LOG:  58P01: could not open configuration file "/var/lib/pgsql/data/foo.conf": No such file or directory
[2022-08-02 12:19:59 UTC]    LOG:  F0000: configuration file "/var/lib/pgsql/data/postgresql.conf" contains errors; no changes were applied

If a configuration file contains an invalid include directive and an attempt is made to start or restart the server, the operation will fail with an error similar to the following:

$ pg_ctl -D /var/lib/pgsql/data start
waiting for server to start....
2022-08-02 11:26:22.175 GMT [1695] LOG: could not open configuration file "/var/lib/pgsql/data/foo.conf": No such file or directory 2022-08-02 11:26:22.175 GMT [1695] FATAL: configuration file "/var/lib/pgsql/data/postgresql.conf" contains errors stopped waiting pg_ctl: could not start server Examine the log output.

Categories

Configuration

See also

include_if_exists, include_dir