From: Nathan Bossart <nathandbossart@gmail.com>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Common function for percent placeholder replacement
Date: Mon, 9 Jan 2023 09:53:57 -0800
Message-ID: <20230109175357.GB1112921@nathanxps13> (raw)
In-Reply-To: <1c2204c9-a38e-3075-56dc-eef9a103a645@enterprisedb.com>
References: <20221219095114.m4nlp4fb3owmsu65@alvherre.pgsql>
<8228593d-1ebc-e061-2c61-3815bb364385@enterprisedb.com>
<20230104003700.GB289060@nathanxps13>
<1c2204c9-a38e-3075-56dc-eef9a103a645@enterprisedb.com>
On Mon, Jan 09, 2023 at 09:36:12AM +0100, Peter Eisentraut wrote:
> On 04.01.23 01:37, Nathan Bossart wrote:
>> On Tue, Dec 20, 2022 at 06:30:40AM +0100, Peter Eisentraut wrote:
>> > + * A value may be NULL. If the corresponding placeholder is found in the
>> > + * input string, the whole function returns NULL.
>>
>> This appears to be carried over from BuildRestoreCommand(), and AFAICT it
>> is only necessary because pg_rewind doesn't support %r in restore_command.
>> IMHO this behavior is counterintuitive and possibly error-prone and should
>> result in an ERROR instead. Since pg_rewind is the only special case, it
>> could independently check for %r before building the command.
>
> Yeah, this annoyed me, too. I have now changed it so that a NULL "value" is
> the same as an unsupported placeholder. This preserves the existing
> behavior.
>
> (Having pg_rewind check for %r itself would probably require replicating
> most of the string processing logic (consider something like "%%r"), so it
> didn't seem appealing.)
Sounds good to me.
> + nativePath = pstrdup(path);
> + make_native_path(nativePath);
> + nativePath = pstrdup(xlogpath);
> + make_native_path(nativePath);
Should these be freed?
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, peter.eisentraut@enterprisedb.com, alvherre@alvh.no-ip.org, pryzby@telsasoft.com
Subject: Re: Common function for percent placeholder replacement
In-Reply-To: <20230109175357.GB1112921@nathanxps13>
References: <20221219095114.m4nlp4fb3owmsu65@alvherre.pgsql> <8228593d-1ebc-e061-2c61-3815bb364385@enterprisedb.com> <20230104003700.GB289060@nathanxps13> <1c2204c9-a38e-3075-56dc-eef9a103a645@enterprisedb.com> <20230109175357.GB1112921@nathanxps13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox