From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't call data type input functions in GUC check hooks
Date: Sun, 30 Jun 2019 09:04:42 +0000
Message-ID: <E1hhVlK-0005Yi-9F@gemulon.postgresql.org> (raw)
Don't call data type input functions in GUC check hooks
Instead of calling pg_lsn_in() in check_recovery_target_lsn and
timestamptz_in() in check_recovery_target_time, reorganize the
respective code so that we don't raise any errors in the check hooks.
The previous code tried to use PG_TRY/PG_CATCH to handle errors in a
way that is not safe, so now the code contains no ereport() calls and
can operate safely within the GUC error handling system.
Moreover, since the interpretation of the recovery_target_time string
may depend on the time zone, we cannot do the final processing of that
string until all the GUC processing is done. Instead,
check_recovery_target_time() now does some parsing for syntax
checking, but the actual conversion to a timestamptz value is done
later in the recovery code that uses it.
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/20190611061115.njjwkagvxp4qujhp%40alap3.anarazel.de
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/21f428ebde39339487c271a830fed135d6032d73
Modified Files
--------------
src/backend/access/transam/xlog.c | 15 +++++-
src/backend/utils/adt/pg_lsn.c | 38 ++++++++++----
src/backend/utils/misc/guc.c | 102 +++++++++++++++-----------------------
src/include/access/xlog.h | 2 +-
src/include/utils/pg_lsn.h | 2 +
5 files changed, 85 insertions(+), 74 deletions(-)
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-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: Don't call data type input functions in GUC check hooks
In-Reply-To: <E1hhVlK-0005Yi-9F@gemulon.postgresql.org>
References: <E1hhVlK-0005Yi-9F@gemulon.postgresql.org>
* 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