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