PostgreSQL HEAD has added a 3-parameter version of GetConfigOptionByName().
authorChristopher Browne <cbbrowne@ca.afilias.info>
Mon, 13 Jul 2015 19:16:07 +0000 (15:16 -0400)
committerChristopher Browne <cbbrowne@ca.afilias.info>
Mon, 13 Jul 2015 19:16:07 +0000 (15:16 -0400)
Have autoconf detect this, and pass 3 parms if needful.

RELEASE
config/acx_libpq.m4
src/backend/slony1_funcs.c

diff --git a/RELEASE b/RELEASE
index 159de720a59de2b6f56efa9ee7b8c41a3b6e2cd1..cbac13082dc15f651acfe11956b3fb00bb8be006 100644 (file)
--- a/RELEASE
+++ b/RELEASE
@@ -11,3 +11,5 @@
 
    - Bug 352 :: Issues with PostgreSQL "head" (what shall become 9.5 or so).  It is pretty usual for #include files to shift a bit and for functions to change arguments a bit.
    - Bug 349 :: Issue with quoting of cluster name - only hit when processing DDL
+   - Bug 359 :: Additional parameter to GetConfigOptionByName() in HEAD
+
index 2f1779ebfe0edc9c5087d37cd8315edac25573ea..47d4b6791e093aee531f3b7d85f95fb90a11ad42 100644 (file)
@@ -463,6 +463,34 @@ else
   AC_MSG_RESULT([yes, and it takes $ac_cv_ScanKeywordLookup_args arguments])
 fi
 
+AC_MSG_CHECKING(for GetConfigOptionByName)
+if test -z "$ac_cv_GetConfigOptionByName_args"; then
+  AC_TRY_COMPILE(
+   [#include "postgres.h" 
+    #include "utils/guc.h"],
+   [GetConfigOptionByName(NULL, NULL); ],
+   ac_cv_GetConfigOptionByName_args=2)
+fi
+if test -z "$ac_cv_GetConfigOptionByName_args"; then
+  AC_TRY_COMPILE(
+   [#include "postgres.h" 
+    #include "utils/guc.h"],
+   [GetConfigOptionByName(NULL, NULL, NULL); ],
+   ac_cv_GetConfigOptionByName_args=3)
+fi
+
+AC_MSG_CHECKING(for GetConfigOptionByName)
+if test -z "$ac_cv_GetConfigOptionByName_args"; then
+   AC_MSG_RESULT(no)
+else
+   if test "$ac_cv_GetConfigOptionByName_args" = 2; then
+      AC_DEFINE(GETCONFIGOPTIONBYNAME_2)
+   elif test "$ac_cv_GetConfigOptionByName_args" = 3; then
+      AC_DEFINE(GETCONFIGOPTIONBYNAME_3)
+   fi
+   AC_MSG_RESULT([yes, and it takes $ac_cv_GetConfigOptionByName_args arguments])
+fi
+
 AC_MSG_CHECKING(for set_config_option)
 if test -z "$ac_cv_set_config_option_args"; then
    AC_TRY_COMPILE(
index 90ce8dc71757aa022d1c4ba155d74cbeee29c603..153c6e5f4a801c31f9c007d6d8efc7bf14e2739c 100644 (file)
@@ -473,7 +473,11 @@ versionFunc(logTrigger) (PG_FUNCTION_ARGS)
        /*
         * Save the current datestyle setting and switch to ISO (if not already)
         */
+#ifdef GETCONFIGOPTIONBYNAME_2
        olddatestyle = GetConfigOptionByName("DateStyle", NULL);
+#elif defined (GETCONFIGOPTIONBYNAME_3)
+       olddatestyle = GetConfigOptionByName("DateStyle", NULL, false);
+#endif
        if (!strstr(olddatestyle, "ISO"))
        {
 #ifdef SETCONFIGOPTION_6