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

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