diff2

text/plain

Filename: diff2
Type: text/plain
Part: 0
Message: Fix for pg_upgrade tablespace function usage
diff --git a/contrib/pg_upgrade/info.c b/contrib/pg_upgrade/info.c
new file mode 100644
index e8361ce..692cdc2
*** a/contrib/pg_upgrade/info.c
--- b/contrib/pg_upgrade/info.c
*************** get_db_infos(ClusterInfo *cluster)
*** 204,210 ****
  	/* we don't preserve pg_database.oid so we sort by name */
  			"ORDER BY 2",
  	/* 9.2 removed the spclocation column */
! 			(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
  			"t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation");
  
  	res = executeQueryOrDie(conn, "%s", query);
--- 204,210 ----
  	/* we don't preserve pg_database.oid so we sort by name */
  			"ORDER BY 2",
  	/* 9.2 removed the spclocation column */
! 			(GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
  			"t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation");
  
  	res = executeQueryOrDie(conn, "%s", query);
*************** get_rel_infos(ClusterInfo *cluster, DbIn
*** 287,293 ****
  	/* we preserve pg_class.oid so we sort by it to match old/new */
  			 "ORDER BY 1;",
  	/* 9.2 removed the spclocation column */
! 			 (GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
  			 "t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation",
  	/* see the comment at the top of old_8_3_create_sequence_script() */
  			 (GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
--- 287,293 ----
  	/* we preserve pg_class.oid so we sort by it to match old/new */
  			 "ORDER BY 1;",
  	/* 9.2 removed the spclocation column */
! 			 (GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
  			 "t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation",
  	/* see the comment at the top of old_8_3_create_sequence_script() */
  			 (GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
diff --git a/contrib/pg_upgrade/tablespace.c b/contrib/pg_upgrade/tablespace.c
new file mode 100644
index 11fd9d0..6b61f4b
*** a/contrib/pg_upgrade/tablespace.c
--- b/contrib/pg_upgrade/tablespace.c
*************** get_tablespace_paths(void)
*** 53,59 ****
  			 "		spcname != 'pg_global'",
  	/* 9.2 removed the spclocation column */
  			(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
! 			"t.spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
  
  	res = executeQueryOrDie(conn, "%s", query);
  
--- 53,59 ----
  			 "		spcname != 'pg_global'",
  	/* 9.2 removed the spclocation column */
  			(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
! 			"spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
  
  	res = executeQueryOrDie(conn, "%s", query);