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

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