mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix new pg_upgrade query not to rely on regnamespace
That was invented in 9.5, and pg_upgrade claims to support back to 9.0. But we don't need that with a simple query change, tested by Tom Lane. Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql
This commit is contained in:
		@@ -1266,12 +1266,13 @@ check_for_not_null_inheritance(ClusterInfo *cluster)
 | 
				
			|||||||
		PGconn	   *conn = connectToServer(&old_cluster, active_db->db_name);
 | 
							PGconn	   *conn = connectToServer(&old_cluster, active_db->db_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		res = executeQueryOrDie(conn,
 | 
							res = executeQueryOrDie(conn,
 | 
				
			||||||
								"SELECT cc.relnamespace::pg_catalog.regnamespace AS nspname, "
 | 
													"SELECT nspname, cc.relname, ac.attname "
 | 
				
			||||||
								"       cc.relname, ac.attname "
 | 
					 | 
				
			||||||
								"FROM pg_catalog.pg_inherits i, pg_catalog.pg_attribute ac, "
 | 
													"FROM pg_catalog.pg_inherits i, pg_catalog.pg_attribute ac, "
 | 
				
			||||||
								"     pg_catalog.pg_attribute ap, pg_catalog.pg_class cc "
 | 
													"     pg_catalog.pg_attribute ap, pg_catalog.pg_class cc, "
 | 
				
			||||||
 | 
													"     pg_catalog.pg_namespace nc "
 | 
				
			||||||
								"WHERE cc.oid = ac.attrelid AND i.inhrelid = ac.attrelid "
 | 
													"WHERE cc.oid = ac.attrelid AND i.inhrelid = ac.attrelid "
 | 
				
			||||||
								"      AND i.inhparent = ap.attrelid AND ac.attname = ap.attname "
 | 
													"      AND i.inhparent = ap.attrelid AND ac.attname = ap.attname "
 | 
				
			||||||
 | 
													"      AND cc.relnamespace = nc.oid "
 | 
				
			||||||
								"      AND ap.attnum > 0 and ap.attnotnull AND NOT ac.attnotnull");
 | 
													"      AND ap.attnum > 0 and ap.attnotnull AND NOT ac.attnotnull");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ntup = PQntuples(res);
 | 
							ntup = PQntuples(res);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user