Blame SOURCES/postgresql-var-run-socket.patch

13fbc1
Change the built-in default socket directory to be /var/run/postgresql.
13fbc1
For backwards compatibility with (probably non-libpq-based) clients that
13fbc1
might still expect to find the socket in /tmp, also create a socket in
13fbc1
/tmp.  This is to resolve communication problems with clients operating
13fbc1
under systemd's PrivateTmp environment, which won't be using the same
13fbc1
global /tmp directory as the server; see bug #825448.
13fbc1
13fbc1
Note that we apply the socket directory change at the level of the
13fbc1
hard-wired defaults in the C code, not by just twiddling the setting in
13fbc1
postgresql.conf.sample; this is so that the change will take effect on
13fbc1
server package update, without requiring any existing postgresql.conf
13fbc1
to be updated.  (Of course, a user who dislikes this behavior can still
13fbc1
override it via postgresql.conf.)
13fbc1
13fbc1
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
13fbc1
index 2b6527f..8e178d4 100644
13fbc1
--- a/src/backend/utils/misc/guc.c
13fbc1
+++ b/src/backend/utils/misc/guc.c
13fbc1
@@ -2971,7 +2971,7 @@ static struct config_string ConfigureNamesString[] =
13fbc1
 		},
13fbc1
 		&Unix_socket_directories,
13fbc1
 #ifdef HAVE_UNIX_SOCKETS
13fbc1
-		DEFAULT_PGSOCKET_DIR,
13fbc1
+		DEFAULT_PGSOCKET_DIR ", /tmp",
13fbc1
 #else
13fbc1
 		"",
13fbc1
 #endif
13fbc1
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
13fbc1
index abf1586..8c01d48 100644
13fbc1
--- a/src/bin/initdb/initdb.c
13fbc1
+++ b/src/bin/initdb/initdb.c
13fbc1
@@ -1204,7 +1204,7 @@ setup_config(void)
13fbc1
 
13fbc1
 #ifdef HAVE_UNIX_SOCKETS
13fbc1
 	snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'",
13fbc1
-			 DEFAULT_PGSOCKET_DIR);
13fbc1
+			 DEFAULT_PGSOCKET_DIR ", /tmp");
13fbc1
 #else
13fbc1
 	snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''");
13fbc1
 #endif
13fbc1
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
13fbc1
index 9ee15d4..e278fa0 100644
13fbc1
--- a/src/include/pg_config_manual.h
13fbc1
+++ b/src/include/pg_config_manual.h
13fbc1
@@ -169,7 +169,7 @@
13fbc1
  * here's where to twiddle it.  You can also override this at runtime
13fbc1
  * with the postmaster's -k switch.
13fbc1
  */
13fbc1
-#define DEFAULT_PGSOCKET_DIR  "/tmp"
13fbc1
+#define DEFAULT_PGSOCKET_DIR  "/var/run/postgresql"
13fbc1
 
13fbc1
 /*
13fbc1
  * This is the default event source for Windows event log.