From 3683d096f10ed013dd3ecb9906c11ea6c93cc1f9 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 1 Aug 2017 10:43:42 +0900 Subject: [PATCH] Avoid using PG_VERSION_NUM in frontend code Debian. --- dbutils.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/dbutils.c b/dbutils.c index dd0c3576..1689cb0a 100644 --- a/dbutils.c +++ b/dbutils.c @@ -2793,13 +2793,18 @@ request_vote(PGconn *conn, t_node_info *this_node, t_node_info *other_node, int initPQExpBuffer(&query); - appendPQExpBuffer( - &query, -#if (PG_VERSION_NUM >= 100000) - "SELECT pg_catalog.pg_last_wal_receive_lsn()"); -#else - "SELECT pg_catalog.pg_last_xlog_receive_location()"); -#endif + if (server_version_num >= 100000) + { + appendPQExpBuffer( + &query, + "SELECT pg_catalog.pg_last_wal_receive_lsn()"); + } + else + { + appendPQExpBuffer( + &query, + "SELECT pg_catalog.pg_last_xlog_receive_location()"); + } res = PQexec(conn, query.data); termPQExpBuffer(&query);