public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: Tom Lane <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Cc: [email protected]
Subject: Re: Set arbitrary GUC options during initdb
Date: Fri, 27 Jan 2023 09:01:51 -0700
Message-ID: <CAKFQuwauwt+w8HbtU_-Mqo-aZ1Qjsah13E5_iFEUTVpVc1PTAw@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>
	<CA+TgmoY4gndkosTZf=Zs1_SfsfO_13c7-yazryweZvLwSTHLgA@mail.gmail.com>
	<[email protected]>

On Fri, Jan 27, 2023 at 8:53 AM Tom Lane <[email protected]> wrote:

> Robert Haas <[email protected]> writes:
> > 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.
>
> Well, yeah, I was trying to avoid writing that ;-).  There's even
> one more wrinkle: we might already have removed the initial '#',
> if one does say "-c max_connections=N", because this logic won't
> know whether the -c switch matches one of initdb's predetermined
> substitutions.
>
> > There might be some quoting-related problems with this idea, not sure.
>
> '#' in a value might confuse it, but we could probably take the last '#'
> not the first.
>
> Anyway, it seems like I gotta work harder.  I'll produce a
> new patch.
>
>
How about just adding a "section" to the end of the file as needed:

# AdHoc Settings Specified During InitDB
max_connections=75
...

David J.


view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Set arbitrary GUC options during initdb
  In-Reply-To: <CAKFQuwauwt+w8HbtU_-Mqo-aZ1Qjsah13E5_iFEUTVpVc1PTAw@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox