From a3ad4033e021614a9b89405bc8682b80bae696f0 Mon Sep 17 00:00:00 2001 From: Hamid Akhtar Date: Thu, 4 Aug 2022 13:47:31 +0500 Subject: [PATCH] PG-476: pg_stat_monitor causing errors : could not read file /tmp/pg_stat_monitor_query: No such file or directory This only fixes the basic the path issue. It moves the query overflow file from /tmp to PGSTAT folder data directory. --- pg_stat_monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pg_stat_monitor.c b/pg_stat_monitor.c index 78325aa..ddba5e0 100644 --- a/pg_stat_monitor.c +++ b/pg_stat_monitor.c @@ -22,6 +22,7 @@ #ifdef BENCHMARK #include /* clock() */ #endif +#include "pgstat.h" #include "commands/explain.h" #include "pg_stat_monitor.h" @@ -29,7 +30,7 @@ PG_MODULE_MAGIC; #define BUILD_VERSION "1.1.0-dev" #define PG_STAT_STATEMENTS_COLS 53 /* maximum of above */ -#define PGSM_TEXT_FILE "/tmp/pg_stat_monitor_query" +#define PGSM_TEXT_FILE PGSTAT_STAT_PERMANENT_DIRECTORY "pg_stat_monitor_query" #define roundf(x,d) ((floor(((x)*pow(10,d))+.5))/pow(10,d))