0

I can't seem to find a way to change the default location of postgresql.conf file from /etc/postgresql/14/main/postgresql.conf to my/own/location/postgresql.conf. I am running postgresql on Ubuntu server. I tried changing it using the postgres command line as per the docs but it gives the following error:

postgres=# ALTER SYSTEM SET config_file='/my/loc/test/postgresql/14/main/postgresql.conf';
ERROR:  parameter "config_file" cannot be changed

any ideas?

Shery
  • 1,808
  • 5
  • 27
  • 51

1 Answers1

0

The PostgreSQL documentation says:

This parameter can only be set on the postgres command line.

So you can only change it when you start the server with

postgres -c config_file=...

This also gives you a clue how to go about it: you have to modify the systemd service file that starts PostgreSQL, ideally by creating a drop-in file in /etc.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263