Set arbitrary GUC options during initdb
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Date: 2023-01-25T21:25:19Z
Lists: pgsql-hackers
Attachments
- set-arbitrary-options-during-initdb-1.patch (text/x-diff) patch
The attached patch responds to the discussion at [1] about how we ought to offer a way to set any server GUC from the initdb command line. Currently, if for some reason the server won't start with default parameters, the only way to get through initdb is to change the installed version of postgresql.conf.sample. And even that is just a kluge, because the initial probes to choose max_connections and shared_buffers will all fail, causing initdb to choose rock-bottom-minimum values of those settings. You can fix that up after the fact if you notice it, but you might not. So this invents an initdb switch "-c NAME=VALUE" just like the one that the server itself has long had. The specified settings are applied on the command line of the initial probe calls (which happen before we've made any config files), and then they are added to postgresql.auto.conf, which causes them to take effect for the bootstrap backend runs as well as subsequent postmaster starts. I also invented "--set NAME=VALUE", mainly because just about every other initdb switch has a long form. The server itself doesn't have that spelling, so I'm not wedded to that part. Thoughts? regards, tom lane [1] https://www.postgresql.org/message-id/flat/17757-dbdfc1f1c954a6db%40postgresql.org
Commits
-
Fix initdb's handling of min_wal_size and max_wal_size.
- b48af6d174bb 16.0 landed
-
Reduce memory leakage in initdb.
- 4fe2aa7656dc 16.0 landed
-
Add "-c name=value" switch to initdb.
- 3e51b278db6a 16.0 landed