Re: Set arbitrary GUC options during initdb

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Set arbitrary GUC options during initdb
Дата
Msg-id CA+TgmoY4gndkosTZf=Zs1_SfsfO_13c7-yazryweZvLwSTHLgA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Set arbitrary GUC options during initdb  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Set arbitrary GUC options during initdb  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Fri, Jan 27, 2023 at 10:34 AM Tom Lane <tgl@sss.pgh.pa.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Matthias van de Meent
Дата:
Сообщение: Re: Named Operators
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: improving user.c error messages