From 432e8ae6d10d52ebac6c54d9acc27205301ef095 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Tue, 27 Feb 2018 13:22:15 +0900 Subject: [PATCH] Allow to support pgpool_switch_xlog PostgreSQL 10. Since PostgreSQL 10, pgpool_switch_xlog used in the recovery second stage fails due to function name changes in PostgreSQL 10. --- src/sql/pgpool-recovery/pgpool-recovery.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/sql/pgpool-recovery/pgpool-recovery.c b/src/sql/pgpool-recovery/pgpool-recovery.c index a99612135..c37a57e7a 100644 --- a/src/sql/pgpool-recovery/pgpool-recovery.c +++ b/src/sql/pgpool-recovery/pgpool-recovery.c @@ -233,7 +233,14 @@ pgpool_switch_xlog(PG_FUNCTION_ARGS) xlogfile_name_oid = get_function_oid("pg_xlogfile_name", pg_xlogfile_name_arg_type, "pg_catalog"); if (!switch_xlog_oid || !xlogfile_name_oid) - elog(ERROR, "cannot find xlog functions"); + { + /* probably PostgreSQL is 10 or greater */ + switch_xlog_oid = get_function_oid("pg_switch_wal", NULL, "pg_catalog"); + xlogfile_name_oid = get_function_oid("pg_walfile_name", pg_xlogfile_name_arg_type, "pg_catalog"); + + if (!switch_xlog_oid || !xlogfile_name_oid) + elog(ERROR, "cannot find xlog functions"); + } location = OidFunctionCall1(switch_xlog_oid, PointerGetDatum(NULL)); filename_t = DatumGetTextP(OidFunctionCall1(xlogfile_name_oid, location)); -- 2.39.5