How to get the PostgreSQL conf file location

Most of the time the default location differs based on the operating system and sometimes depends on the version also the location may change, and also maybe depend on how you install the server.

To get the location of postgresql.conf

Execute the query show config_file; will give you the location of the conf file

psql -U postgres -c 'SHOW config_file'

Run show config_file from non-default user

vignesh=> SHOW config_file;
ERROR: must be superuser or a member of pg_read_all_settings to examine "config_file"


Role : pg_read_all_settings : Read all configuration variables, even those normally visible only to superusers.

Grant Role to the non-default user

ubuntu@ip-172-31-12-90:~$ psql -U postgres
psql (10.12 (Ubuntu 10.12-0ubuntu0.18.04.1))

postgres=# GRANT pg_read_all_settings TO vignesh;

Also published on Medium.

This site uses Akismet to reduce spam. Learn how your comment data is processed.