From 92d2e0b1366297b8b8fe584cd398641edbf3e803 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 31 Dec 2021 00:33:41 +0300 Subject: [PATCH] [mod_pgsql] Fix build by using PG_VERSION_NUM provided by libpq instead of using POSTGRESQL_MAJOR_VERSION detected by freeswitch configure. --- src/mod/databases/mod_pgsql/mod_pgsql.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod/databases/mod_pgsql/mod_pgsql.c b/src/mod/databases/mod_pgsql/mod_pgsql.c index b638a4feae..575252223b 100644 --- a/src/mod/databases/mod_pgsql/mod_pgsql.c +++ b/src/mod/databases/mod_pgsql/mod_pgsql.c @@ -36,6 +36,7 @@ #include #include +#include #ifndef _WIN32 #include @@ -597,7 +598,7 @@ switch_status_t database_handle_exec_string(switch_database_interface_handle_t * goto done; } else { switch (result->status) { -#if POSTGRESQL_MAJOR_VERSION >= 9 && POSTGRESQL_MINOR_VERSION >= 2 +#if PG_VERSION_NUM >= 90002 case PGRES_SINGLE_TUPLE: /* Added in PostgreSQL 9.2 */ #endif @@ -756,25 +757,25 @@ switch_status_t pgsql_next_result_timed(switch_pgsql_handle_t *handle, switch_pg *result_out = res; res->status = PQresultStatus(res->result); switch (res->status) { -//#if (POSTGRESQL_MAJOR_VERSION == 9 && POSTGRESQL_MINOR_VERSION >= 2) || POSTGRESQL_MAJOR_VERSION > 9 +#if PG_VERSION_NUM >= 90002 case PGRES_SINGLE_TUPLE: /* Added in PostgreSQL 9.2 */ -//#endif +#endif case PGRES_TUPLES_OK: { res->rows = PQntuples(res->result); res->cols = PQnfields(res->result); } break; -//#if (POSTGRESQL_MAJOR_VERSION == 9 && POSTGRESQL_MINOR_VERSION >= 1) || POSTGRESQL_MAJOR_VERSION > 9 +#if PG_VERSION_NUM >= 90001 case PGRES_COPY_BOTH: /* Added in PostgreSQL 9.1 */ -//#endif +#endif case PGRES_COPY_OUT: case PGRES_COPY_IN: case PGRES_COMMAND_OK: break; -#if POSTGRESQL_MAJOR_VERSION >= 14 +#if PG_VERSION_NUM >= 140001 case PGRES_PIPELINE_ABORTED: case PGRES_PIPELINE_SYNC: break;