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