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

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