pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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: Tue, 3 Jan 2023 16:37:00 -0800
Message-ID: <20230104003700.GB289060@nathanxps13> (raw)
In-Reply-To: <8228593d-1ebc-e061-2c61-3815bb364385@enterprisedb.com>
References: <20221219095114.m4nlp4fb3owmsu65@alvherre.pgsql>
	<8228593d-1ebc-e061-2c61-3815bb364385@enterprisedb.com>

In general, +1.

On Tue, Dec 20, 2022 at 06:30:40AM +0100, Peter Eisentraut wrote:
> (Still need to think about Robert's comment about lack of error context.)

Would adding the name of the GUC be sufficient?

	ereport(ERROR,
			(errmsg("could not build %s", guc_name),
			 errdetail("string ends unexpectedly after escape character \"%%\"")));

> + * 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.

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com





view thread (16+ messages)  latest in thread

Message-ID: <20230104003700.GB289060@nathanxps13>
Permalink:  ../20230104003700.GB289060@nathanxps13/
Also on:    postgresql.org/message-id/20230104003700.GB289060@nathanxps13

 · 

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 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: <20230104003700.GB289060@nathanxps13>
  References: <20221219095114.m4nlp4fb3owmsu65@alvherre.pgsql> <8228593d-1ebc-e061-2c61-3815bb364385@enterprisedb.com> <20230104003700.GB289060@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