Deal with PostgreSQL 12.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Mon, 29 Apr 2019 23:46:06 +0000 (08:46 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Tue, 30 Apr 2019 06:26:33 +0000 (15:26 +0900)
HeapTupleGetOid() is not available any more in PostgreSQL 12. Use
GETSTRUCT() and refer to oid column of Form_pg_proc.

src/sql/pgpool-recovery/pgpool-recovery.c

index a82b67640a0df5ca94d5fac8e1b64d82bb5217a6..5bca95ca0c0d999ba80b38866c9647c7733bd54f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * pgpool-recovery: exec online recovery script from SELECT statement.
  *
- * Copyright (c) 2003-2018     PgPool Global Development Group
+ * Copyright (c) 2003-2019     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -27,6 +27,7 @@
 #include "executor/spi.h"
 #include "funcapi.h"
 #include "catalog/namespace.h"
+#include "catalog/pg_proc.h"
 #include "utils/syscache.h"
 #include "utils/builtins.h"            /* PostgreSQL 8.4 needs this for textout */
 #include "utils/guc.h"
@@ -294,8 +295,10 @@ get_function_oid(const char *funcname, const char *argtype, const char *nspname)
         * returns invlaid_oid. See include/catalog/namespace.h */
        nspid = LookupExplicitNamespace(nspname, false);
 #endif
+
        elog(DEBUG1, "get_function_oid: oid of \"%s\": %d", nspname, nspid);
 
+
        tup = SearchSysCache(PROCNAMEARGSNSP,
                                                 PointerGetDatum(funcname),
                                                 PointerGetDatum(oid_v),
@@ -304,7 +307,12 @@ get_function_oid(const char *funcname, const char *argtype, const char *nspname)
 
        if (HeapTupleIsValid(tup))
        {
+#if defined(PG_VERSION_NUM) && (PG_VERSION_NUM >= 120000)
+               Form_pg_proc proctup = (Form_pg_proc) GETSTRUCT(tup);
+               funcid = proctup->oid;
+#else
                funcid = HeapTupleGetOid(tup);
+#endif
                elog(DEBUG1, "get_function_oid: oid of \"%s\": %d", funcname, funcid);
                ReleaseSysCache(tup);
                return funcid;