config_file
config_file
is a configuration parameter specifying the location of the main postgresql.conf
file.
config_file
was added in PostgreSQL 8.1.
Default value
Default value for config_file
is: data_directory
.
Usage
config_file
can only be provided as an option on the postgres
command line to specify where it should read its configuration from. Once the database instance has started, it can only be used to show the location of the main postgresql.conf
file.
Note that this will only show the location of the main configuration file, which may include one or more other configuration files via the various include mechanisms. To locate the source of particular configuration items, refer to the pg_settings
view (which can also be used to determine the location of all configuration files included from the main configuration file).
If config_file
was not specified, PostgreSQL will expect to find postgresql.conf
in the data_directory.
Change history
- PostgreSQL 8.1
- added (commit 337ffcdd)
Examples
Display the current configuration file location:
postgres=# SHOW config_file; config_file ------------------------------------- /var/lib/pgsql/data/postgresql.conf (1 row)
config_file
cannot be modified:
postgres=# ALTER SYSTEM SET config_file = '/var/lib/pgsql/data/postgresql-new.conf'; ERROR: parameter "config_file" cannot be changed
Passing a custom configuration file location via pg_ctl
:
$ pg_ctl -D /tmp/testdb -o '-c config_file=/tmp/testdb-conf/postgresql.conf -p6432' -l /tmp/testdb.log start waiting for server to start.... done server started $ psql -p 6432 -c 'SHOW config_file' config_file ---------------------------------- /tmp/testdb-conf/postgresql.conf (1 row)
References
- PostgreSQL documentation: config_file