From 3fec49dd2e0c959dc4da9fd3b89df841a63ce786 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi <horiguchi.kyotaro@lab.ntt.co.jp>
Date: Wed, 4 Jul 2018 10:59:17 +0900
Subject: [PATCH 5/6] Let pg_stat_statements not to use PG_STAT_TMP_DIR.

This patchset removes the definition because pg_stat.c no longer uses
the directory and no other sutable module to pass it over. As a
tentative solution this patch moves query text file into permanent
stats directory. pg_basebackup and pg_rewind are conscious of the
directory. They currently omit the text file but becomes to copy it by
this change.
---
 contrib/pg_stat_statements/pg_stat_statements.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/contrib/pg_stat_statements/pg_stat_statements.c b/contrib/pg_stat_statements/pg_stat_statements.c
index cc9efab243..cdff585e76 100644
--- a/contrib/pg_stat_statements/pg_stat_statements.c
+++ b/contrib/pg_stat_statements/pg_stat_statements.c
@@ -86,14 +86,11 @@ PG_MODULE_MAGIC;
 #define PGSS_DUMP_FILE	PGSTAT_STAT_PERMANENT_DIRECTORY "/pg_stat_statements.stat"
 
 /*
- * Location of external query text file.  We don't keep it in the core
- * system's stats_temp_directory.  The core system can safely use that GUC
- * setting, because the statistics collector temp file paths are set only once
- * as part of changing the GUC, but pg_stat_statements has no way of avoiding
- * race conditions.  Besides, we only expect modest, infrequent I/O for query
- * strings, so placing the file on a faster filesystem is not compelling.
+ * Location of external query text file. We only expect modest, infrequent I/O
+ * for query strings, so placing the file on a faster filesystem is not
+ * compelling.
  */
-#define PGSS_TEXT_FILE	PG_STAT_TMP_DIR "/pgss_query_texts.stat"
+#define PGSS_TEXT_FILE	PGSTAT_STAT_PERMANENT_DIRECTORY "/pgss_query_texts.stat"
 
 /* Magic number identifying the stats file format */
 static const uint32 PGSS_FILE_HEADER = 0x20171004;
-- 
2.16.3

