From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Set arbitrary GUC options during initdb |
Date: | 2023-01-27 15:41:51 |
Message-ID: | CA+TgmoY4gndkosTZf=Zs1_SfsfO_13c7-yazryweZvLwSTHLgA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Jan 27, 2023 at 10:34 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> One idea if we want to make it work like that could be to stop
> trying to edit out the default value, and instead make the file
> contents look like, say,
>
> #huge_pages = try # on, off, or try
> huge_pages = off # set by initdb
How about just making replace_token() a little smarter, and maybe renaming it?
The idea is that instead of:
replace_token(conflines, "#max_connections = 100", repltok);
You'd write something like:
replace_guc_value(conflines, "max_connections", repltok);
Which would look for a line matching /^#max_connections\s+=\s/, and
then identify everything following that point up to the first #. It
would replace all that stuff with repltok, but if the replacement is
shorter than the original, it would pad with spaces to get back to the
original length. And otherwise it would add a single space, so that if
you set a super long GUC value there's still at least one space
between the end of the value and the comment that follows.
There might be some quoting-related problems with this idea, not sure.
--
Robert Haas
EDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Nathan Bossart | 2023-01-27 15:52:36 | Re: improving user.c error messages |
Previous Message | Matthias van de Meent | 2023-01-27 15:34:52 | Re: Named Operators |