Blame SOURCES/postgresql-socket-dirs-pgupgrade.patch

5cb31b
Expect unix_socket_directories on RHEL's PostgreSQL 9.2
5cb31b
5cb31b
If REDHAT_PGUPGRADE_FROM_RHEL is defined, (Red Hat only versions of) pg_upgrade
5cb31b
are told to run the older server than 9.2 with unix_socket_directories instead
5cb31b
of unix_socket_directory.  By default, even 9.2 is called with
5cb31b
unix_socket_directory which breaks upgrade from RHSCL 9.2.
5cb31b
5cb31b
diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
5cb31b
index 3d041ef..a9c56e0 100644
5cb31b
--- a/src/bin/pg_upgrade/server.c
5cb31b
+++ b/src/bin/pg_upgrade/server.c
5cb31b
@@ -191,6 +191,12 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
5cb31b
 
5cb31b
 	static bool exit_hook_registered = false;
5cb31b
 
5cb31b
+	/* By default set to what upstream uses */
5cb31b
+	int			rh_sock_dir_split = 903;
5cb31b
+	if (getenv("REDHAT_PGUPGRADE_FROM_RHEL")) {
5cb31b
+		rh_sock_dir_split = 902;
5cb31b
+	}
5cb31b
+
5cb31b
 	if (!exit_hook_registered)
5cb31b
 	{
5cb31b
 		atexit(stop_postmaster_atexit);
5cb31b
@@ -196,7 +202,7 @@ start_postmaster(ClusterInfo *cluster, bool throw_error)
5cb31b
 		snprintf(socket_string + strlen(socket_string),
5cb31b
 				 sizeof(socket_string) - strlen(socket_string),
5cb31b
 				 " -c %s='%s'",
5cb31b
-				 (GET_MAJOR_VERSION(cluster->major_version) < 903) ?
5cb31b
+				 (GET_MAJOR_VERSION(cluster->major_version) < rh_sock_dir_split) ?
5cb31b
 				 "unix_socket_directory" : "unix_socket_directories",
5cb31b
 				 cluster->sockdir);
5cb31b
 #endif