DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · File Locations

config_file

Sets the server's main configuration file.

  • Default: '' (empty)
  • Type: string
  • Applies: Restart required

In plain words

Tells the server which postgresql.conf to read. By default it is inside the data directory. It can only be given on the command line (postgres -c config_file=…), because it obviously cannot be set inside the file it names.

For DBAs and operators

Order at startup: if -D points at a directory with postgresql.conf, that file is read; it may then set data_directory, hba_file and ident_file. Alternatively config_file names the file directly and -D/data_directory the data. postgresql.auto.conf (written by ALTER SYSTEM) is always read from the data directory, after the main file, so its values win.

SHOW config_file;
SELECT sourcefile, sourceline, name, setting, applied, error
  FROM pg_file_settings ORDER BY sourcefile, sourceline;

pg_file_settings shows every line from every included file and whether it was applied, the quickest way to answer "why is my setting ignored?" (later duplicates and postgresql.auto.conf override earlier lines). include, include_if_exists and include_dir (e.g. conf.d) are resolved relative to the including file.

How to change it

Change in postgresql.conf or ALTER SYSTEM, then restart the server.

See it in context

Physical layout on disk Postmaster

Related parameters

data_directory hba_file ident_file allow_alter_system

All File Locations parameters