|
|
699f87 |
Change the built-in default socket directory to be /var/run/postgresql.
|
|
|
699f87 |
For backwards compatibility with (probably non-libpq-based) clients that
|
|
|
699f87 |
might still expect to find the socket in /tmp, also create a socket in
|
|
|
699f87 |
/tmp. This is to resolve communication problems with clients operating
|
|
|
699f87 |
under systemd's PrivateTmp environment, which won't be using the same
|
|
|
699f87 |
global /tmp directory as the server; see bug #825448.
|
|
|
699f87 |
|
|
|
699f87 |
Note that we apply the socket directory change at the level of the
|
|
|
699f87 |
hard-wired defaults in the C code, not by just twiddling the setting in
|
|
|
699f87 |
postgresql.conf.sample; this is so that the change will take effect on
|
|
|
699f87 |
server package update, without requiring any existing postgresql.conf
|
|
|
699f87 |
to be updated. (Of course, a user who dislikes this behavior can still
|
|
|
699f87 |
override it via postgresql.conf.)
|
|
|
699f87 |
|
|
|
699f87 |
This patch must be applied after postgresql-multi-sockets.patch, at
|
|
|
699f87 |
least until 9.3 when that will be part of the upstream package.
|
|
|
699f87 |
|
|
|
699f87 |
diff --git a/contrib/pg_upgrade/test.sh b/contrib/pg_upgrade/test.sh
|
|
|
699f87 |
index d44c599..845b417 100644
|
|
|
699f87 |
--- a/contrib/pg_upgrade/test.sh
|
|
|
699f87 |
+++ b/contrib/pg_upgrade/test.sh
|
|
|
699f87 |
@@ -121,6 +121,12 @@ logdir=$PWD/log
|
|
|
699f87 |
rm -rf "$logdir"
|
|
|
699f87 |
mkdir "$logdir"
|
|
|
699f87 |
|
|
|
699f87 |
+# we want the Unix sockets in $temp_root
|
|
|
699f87 |
+PGHOST=$temp_root
|
|
|
699f87 |
+export PGHOST
|
|
|
699f87 |
+
|
|
|
699f87 |
+POSTMASTER_OPTS="$POSTMASTER_OPTS -c unix_socket_directories='$PGHOST'"
|
|
|
699f87 |
+
|
|
|
699f87 |
# enable echo so the user can see what is being executed
|
|
|
699f87 |
set -x
|
|
|
699f87 |
|
|
|
699f87 |
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
|
|
|
699f87 |
index 1428cb6..3613732 100644
|
|
|
699f87 |
--- a/src/backend/utils/misc/guc.c
|
|
|
699f87 |
+++ b/src/backend/utils/misc/guc.c
|
|
|
699f87 |
@@ -2901,7 +2901,7 @@ static struct config_string ConfigureNamesString[] =
|
|
|
699f87 |
},
|
|
|
699f87 |
&Unix_socket_directories,
|
|
|
699f87 |
#ifdef HAVE_UNIX_SOCKETS
|
|
|
699f87 |
- DEFAULT_PGSOCKET_DIR,
|
|
|
699f87 |
+ DEFAULT_PGSOCKET_DIR ", /tmp",
|
|
|
699f87 |
#else
|
|
|
699f87 |
"",
|
|
|
699f87 |
#endif
|
|
|
699f87 |
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
|
|
|
699f87 |
index 452ac0b..ce6ca96 100644
|
|
|
699f87 |
--- a/src/bin/initdb/initdb.c
|
|
|
699f87 |
+++ b/src/bin/initdb/initdb.c
|
|
|
699f87 |
@@ -1015,7 +1015,7 @@ setup_config(void)
|
|
|
699f87 |
|
|
|
699f87 |
#ifdef HAVE_UNIX_SOCKETS
|
|
|
699f87 |
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'",
|
|
|
699f87 |
- DEFAULT_PGSOCKET_DIR);
|
|
|
699f87 |
+ DEFAULT_PGSOCKET_DIR ", /tmp");
|
|
|
699f87 |
#else
|
|
|
699f87 |
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''");
|
|
|
699f87 |
#endif
|
|
|
699f87 |
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
|
|
|
699f87 |
index ee7dab0..f3e3ed9 100644
|
|
|
699f87 |
--- a/src/include/pg_config_manual.h
|
|
|
699f87 |
+++ b/src/include/pg_config_manual.h
|
|
|
699f87 |
@@ -144,7 +144,7 @@
|
|
|
699f87 |
* here's where to twiddle it. You can also override this at runtime
|
|
|
699f87 |
* with the postmaster's -k switch.
|
|
|
699f87 |
*/
|
|
|
699f87 |
-#define DEFAULT_PGSOCKET_DIR "/tmp"
|
|
|
699f87 |
+#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
|
|
|
699f87 |
|
|
|
699f87 |
/*
|
|
|
699f87 |
* The random() function is expected to yield values between 0 and
|