Don't call data type input functions in GUC check hooks
Peter Eisentraut <peter@eisentraut.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/xlog.c | modified | +14 −1 |
| src/backend/utils/adt/pg_lsn.c | modified | +27 −11 |
| src/backend/utils/misc/guc.c | modified | +41 −61 |
| src/include/access/xlog.h | modified | +1 −1 |
| src/include/utils/pg_lsn.h | modified | +2 −0 |
Discussion
- check_recovery_target_lsn() does a PG_CATCH without a throw 16 messages · 2019-06-11 → 2019-07-05