summaryrefslogtreecommitdiff
path: root/postgresql-var-run-socket.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2024-06-24 10:01:23 +0000
committerCoprDistGit <infra@openeuler.org>2024-06-24 10:01:23 +0000
commit2bf73940674385629e4eaed7d9df573671a12256 (patch)
tree1dd3991fe20aedb65e94fd2b680507f5e23da852 /postgresql-var-run-socket.patch
parentce92b1d6b55661459c9ba8d7f30c3d63cf0fe81a (diff)
Diffstat (limited to 'postgresql-var-run-socket.patch')
-rw-r--r--postgresql-var-run-socket.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/postgresql-var-run-socket.patch b/postgresql-var-run-socket.patch
new file mode 100644
index 0000000..91dceab
--- /dev/null
+++ b/postgresql-var-run-socket.patch
@@ -0,0 +1,53 @@
+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.)
+
+diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
+index 9481f2d..75532c7 100644
+--- a/src/backend/utils/misc/guc.c
++++ b/src/backend/utils/misc/guc.c
+@@ -3196,7 +3196,7 @@ static struct config_string ConfigureNamesString[] =
+ },
+ &Unix_socket_directories,
+ #ifdef HAVE_UNIX_SOCKETS
+- DEFAULT_PGSOCKET_DIR,
++ DEFAULT_PGSOCKET_DIR ", /tmp",
+ #else
+ "",
+ #endif
+diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
+index feeff9e..3e3d784 100644
+--- a/src/bin/initdb/initdb.c
++++ b/src/bin/initdb/initdb.c
+@@ -1234,7 +1234,7 @@ setup_config(void)
+
+ #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
+diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
+index e278fa0..9ee15d4 100644
+--- a/src/include/pg_config_manual.h
++++ b/src/include/pg_config_manual.h
+@@ -201,7 +201,7 @@
+ * support them yet.
+ */
+ #ifndef WIN32
+-#define DEFAULT_PGSOCKET_DIR "/tmp"
++#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
+ #else
+ #define DEFAULT_PGSOCKET_DIR ""
+ #endif