Blame SOURCES/libpq-10.3-var-run-socket.patch

7db026
Change the built-in default socket directory to be /var/run/postgresql.
7db026
For backwards compatibility with (probably non-libpq-based) clients that
7db026
might still expect to find the socket in /tmp, also create a socket in
7db026
/tmp.  This is to resolve communication problems with clients operating
7db026
under systemd's PrivateTmp environment, which won't be using the same
7db026
global /tmp directory as the server; see bug #825448.
7db026
7db026
Note that we apply the socket directory change at the level of the
7db026
hard-wired defaults in the C code, not by just twiddling the setting in
7db026
postgresql.conf.sample; this is so that the change will take effect on
7db026
server package update, without requiring any existing postgresql.conf
7db026
to be updated.  (Of course, a user who dislikes this behavior can still
7db026
override it via postgresql.conf.)
7db026
7db026
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
7db026
index 4dde819652..8c2f601333 100644
7db026
--- a/src/backend/utils/misc/guc.c
7db026
+++ b/src/backend/utils/misc/guc.c
7db026
@@ -4159,7 +4159,7 @@ static struct config_string ConfigureNamesString[] =
7db026
 		},
7db026
 		&Unix_socket_directories,
7db026
 #ifdef HAVE_UNIX_SOCKETS
7db026
-		DEFAULT_PGSOCKET_DIR,
7db026
+		DEFAULT_PGSOCKET_DIR ", /tmp",
7db026
 #else
7db026
 		"",
7db026
 #endif
7db026
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
7db026
index 4ff0c6c700..6ccd96b1f2 100644
7db026
--- a/src/bin/initdb/initdb.c
7db026
+++ b/src/bin/initdb/initdb.c
7db026
@@ -1091,7 +1091,7 @@ setup_config(void)
7db026
 
7db026
 #ifdef HAVE_UNIX_SOCKETS
7db026
 	snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'",
7db026
-			 DEFAULT_PGSOCKET_DIR);
7db026
+			 DEFAULT_PGSOCKET_DIR ", /tmp");
7db026
 #else
7db026
 	snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''");
7db026
 #endif
7db026
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
7db026
index 8f3ec6bde1..066daf3f08 100644
7db026
--- a/src/include/pg_config_manual.h
7db026
+++ b/src/include/pg_config_manual.h
7db026
@@ -201,7 +201,7 @@
7db026
  * support them yet.
7db026
  */
7db026
 #ifndef WIN32
7db026
-#define DEFAULT_PGSOCKET_DIR  "/tmp"
7db026
+#define DEFAULT_PGSOCKET_DIR  "/var/run/postgresql"
7db026
 #else
7db026
 #define DEFAULT_PGSOCKET_DIR ""
7db026
 #endif