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