mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix new SQL tablespace location function usage in pg_upgrade to properly
check cluster version numbers, and fix missing table alias.
This commit is contained in:
		@@ -204,7 +204,7 @@ get_db_infos(ClusterInfo *cluster)
 | 
				
			|||||||
	/* we don't preserve pg_database.oid so we sort by name */
 | 
						/* we don't preserve pg_database.oid so we sort by name */
 | 
				
			||||||
			"ORDER BY 2",
 | 
								"ORDER BY 2",
 | 
				
			||||||
	/* 9.2 removed the spclocation column */
 | 
						/* 9.2 removed the spclocation column */
 | 
				
			||||||
			(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
 | 
								(GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
 | 
				
			||||||
			"t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation");
 | 
								"t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res = executeQueryOrDie(conn, "%s", query);
 | 
						res = executeQueryOrDie(conn, "%s", query);
 | 
				
			||||||
@@ -287,7 +287,7 @@ get_rel_infos(ClusterInfo *cluster, DbInfo *dbinfo)
 | 
				
			|||||||
	/* we preserve pg_class.oid so we sort by it to match old/new */
 | 
						/* we preserve pg_class.oid so we sort by it to match old/new */
 | 
				
			||||||
			 "ORDER BY 1;",
 | 
								 "ORDER BY 1;",
 | 
				
			||||||
	/* 9.2 removed the spclocation column */
 | 
						/* 9.2 removed the spclocation column */
 | 
				
			||||||
			 (GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
 | 
								 (GET_MAJOR_VERSION(cluster->major_version) <= 901) ?
 | 
				
			||||||
			 "t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation",
 | 
								 "t.spclocation" : "pg_catalog.pg_tablespace_location(t.oid) AS spclocation",
 | 
				
			||||||
	/* see the comment at the top of old_8_3_create_sequence_script() */
 | 
						/* see the comment at the top of old_8_3_create_sequence_script() */
 | 
				
			||||||
			 (GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
 | 
								 (GET_MAJOR_VERSION(old_cluster.major_version) <= 803) ?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,7 +53,7 @@ get_tablespace_paths(void)
 | 
				
			|||||||
			 "		spcname != 'pg_global'",
 | 
								 "		spcname != 'pg_global'",
 | 
				
			||||||
	/* 9.2 removed the spclocation column */
 | 
						/* 9.2 removed the spclocation column */
 | 
				
			||||||
			(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
 | 
								(GET_MAJOR_VERSION(old_cluster.major_version) <= 901) ?
 | 
				
			||||||
			"t.spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
 | 
								"spclocation" : "pg_catalog.pg_tablespace_location(oid) AS spclocation");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	res = executeQueryOrDie(conn, "%s", query);
 | 
						res = executeQueryOrDie(conn, "%s", query);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user