Fix log messages for PostgreSQL 9.6 and later
authorIan Barwick <ian@2ndquadrant.com>
Mon, 9 Jul 2018 04:35:38 +0000 (13:35 +0900)
committerIan Barwick <ian@2ndquadrant.com>
Mon, 9 Jul 2018 04:35:38 +0000 (13:35 +0900)
Definition of "FuncCallContext" has chanegd to use uint64 in place of
uint32 (commit 23a27b039d94ba359286694831eafe03cd970eef).

src/pg_proctab.c

index 978cc533e17724b3c9e91bbdb79672227b5aaa5a..8cf2f12b66f9e67f15d3007c79ab7e08616a435b 100644 (file)
@@ -134,8 +134,14 @@ Datum pg_proctab(PG_FUNCTION_ARGS)
 
                        /* total number of tuples to be returned */
                        funcctx->max_calls = SPI_processed;
-                       elog(DEBUG5, "pg_proctab: %d process(es) in pg_stat_activity.",
+
+#if (PG_VERSION_NUM >= 90600)
+                       elog(DEBUG5, "pg_proctab: %lu process(es) in pg_stat_activity.",
+                                       funcctx->max_calls);
+#else
+                       elog(DEBUG5, "pg_proctab: %lu process(es) in pg_stat_activity.",
                                        funcctx->max_calls);
+#endif
                        funcctx->user_fctx = MemoryContextAlloc(
                                        funcctx->multi_call_memory_ctx, sizeof(int32) *
                                        funcctx->max_calls);
@@ -274,8 +280,13 @@ get_proctab(FuncCallContext *funcctx, char **values)
 
        ppid = (int32 *) funcctx->user_fctx;
        pid = ppid[funcctx->call_cntr];
+#if (PG_VERSION_NUM >= 90600)
+       elog(DEBUG5, "pg_proctab: accessing process table for pid[%lu] %d.",
+                               funcctx->call_cntr, pid);
+#else
        elog(DEBUG5, "pg_proctab: accessing process table for pid[%d] %d.",
                                funcctx->call_cntr, pid);
+#endif
 
        /* Get the full command line information. */
        snprintf(buffer, sizeof(buffer) - 1, "%s/%d/cmdline", PROCFS, pid);