I am often editing the pg_hda.conf file and I was just wondering if there is a way to make sure that what I just wrote is correct.
So far I'm using a test server to check my changes.
Like Apache has its apache2ctl -t
command, does Postgres has something similar?
PostgreSQL configuration files are stored in the /etc/postgresql/<version>/main directory. For example, if you install PostgreSQL 12, the configuration files are stored in the /etc/postgresql/12/main directory. To configure IDENT authentication, add entries to the /etc/postgresql/12/main/pg_ident. conf file.
conf is PostgreSQL's main configuration file and the primary source of configuration parameter settings. postgresql. conf is a plain text file generated by initdb and is normally stored in the data directory. However some distributions' packages may place postgresql.
Open the PostgreSQL configuration file. The file is named postgresql. conf. By default, on RHEL 7, the file is at /var/lib/pgsql/data/, and on Windows, the file is at C:\Program Files\PostgreSQL\ version_number \data\.
It's bee a long time, but now check is available for pg_hba.conf file:
select pg_hba_file_rules();
Also, you may use pg_file_settings view to define error in postgresql.conf:
select sourcefile, name,sourceline,error from pg_file_settings where error is not null;
example output:
postgres=# select sourcefile, name,sourceline,error from pg_file_settings where error is not null; sourcefile | name | sourceline | error ----------------------------------------+--------+------------+-------------------------------------- /var/lib/pgsql/11/data/postgresql.conf | lalala | 1 | unrecognized configuration parameter
here I put some bad stuff to check if it's true :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With