@@ -51,9 +51,18 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
5151RelInfo * new_rel = & new_db -> rel_arr .rels [relnum ];
5252
5353if (old_rel -> reloid != new_rel -> reloid )
54- pg_log (PG_FATAL ,"mismatch of relation id: database \"%s\", old relid %d, new relid %d\n" ,
54+ pg_log (PG_FATAL ,"Mismatch of relation id: database \"%s\", old relid %d, new relid %d\n" ,
5555old_db -> db_name ,old_rel -> reloid ,new_rel -> reloid );
56-
56+
57+ /* toast names were not renamed to match their relfilenodes in pre-8.4 */
58+ if (GET_MAJOR_VERSION (old_cluster .major_version ) >=804 &&
59+ (strcmp (old_rel -> nspname ,new_rel -> nspname )!= 0 ||
60+ strcmp (old_rel -> relname ,new_rel -> relname )!= 0 ))
61+ pg_log (PG_FATAL ,"Mismatch of relation names: database \"%s\", "
62+ "old rel %s.%s, new rel %s.%s\n" ,
63+ old_db -> db_name ,old_rel -> nspname ,old_rel -> relname ,
64+ new_rel -> nspname ,new_rel -> relname );
65+
5766create_rel_filename_map (old_pgdata ,new_pgdata ,old_db ,new_db ,
5867old_rel ,new_rel ,maps + num_maps );
5968num_maps ++ ;
@@ -104,12 +113,6 @@ create_rel_filename_map(const char *old_data, const char *new_data,
104113/* new_relfilenode will match old and new pg_class.oid */
105114map -> new_relfilenode = new_rel -> relfilenode ;
106115
107- if (strcmp (old_rel -> nspname ,new_rel -> nspname )!= 0 ||
108- strcmp (old_rel -> relname ,new_rel -> relname )!= 0 )
109- pg_log (PG_FATAL ,"mismatch of relation id: database \"%s\", old rel %s.%s, new rel %s.%s\n" ,
110- old_db -> db_name ,old_rel -> nspname ,old_rel -> relname ,
111- new_rel -> nspname ,new_rel -> relname );
112-
113116/* used only for logging and error reporing, old/new are identical */
114117snprintf (map -> nspname ,sizeof (map -> nspname ),"%s" ,old_rel -> nspname );
115118snprintf (map -> relname ,sizeof (map -> relname ),"%s" ,old_rel -> relname );