patternsqlMinor
Command to validate a postgresql configuration file?
Viewed 0 times
validatepostgresqlfilecommandconfiguration
Problem
I am generating postgresql configuration files via ansible, and putting them in
Is there any postgresql command to validate that a file is a valid postgresql.conf file?
I'm currently running Ubuntu 18.04 & 20.04, with PostgreSQL 10, 12 etc (yes several different versions).
/etc/postgresql/XX/main/conf.d/whatever.conf. I accidentally made a syntax error and broke my postgresql, requiring manual fixing.Is there any postgresql command to validate that a file is a valid postgresql.conf file?
sudoers files can be validates with /usr/sbin/visudo -cf path/to/file. Is there anything for postgresql?I'm currently running Ubuntu 18.04 & 20.04, with PostgreSQL 10, 12 etc (yes several different versions).
Solution
The only program that I know is
I have two approaches to deal with that problem:
-
After you edit
-
Use
As an alternative to checking the log file, you may use the
postgres, the database server.I have two approaches to deal with that problem:
-
After you edit
postgresql.conf and reload, examine the PostgreSQL log file. If there was a problem, you will see that in the log, an the server will keep running with the previous configuration (no outage). Fix the file and try again until it the reload is successful.-
Use
ALTER SYSTEM rather than postgresql.conf to change configuration parameters. That works just as well, and ALTER SYSTEM will catch most of the possible syntax errors. Of course, you should still look at the PostgreSQL log after reloading.As an alternative to checking the log file, you may use the
pg_file_settings view as described in the other answer.Context
StackExchange Database Administrators Q#306171, answer score: 4
Revisions (0)
No revisions yet.