@@ -51,9 +51,18 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
51
51
RelInfo * new_rel = & new_db -> rel_arr .rels [relnum ];
52
52
53
53
if (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" ,
55
55
old_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
+
57
66
create_rel_filename_map (old_pgdata , new_pgdata , old_db , new_db ,
58
67
old_rel , new_rel , maps + num_maps );
59
68
num_maps ++ ;
@@ -104,12 +113,6 @@ create_rel_filename_map(const char *old_data, const char *new_data,
104
113
/* new_relfilenode will match old and new pg_class.oid */
105
114
map -> new_relfilenode = new_rel -> relfilenode ;
106
115
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
-
113
116
/* used only for logging and error reporing, old/new are identical */
114
117
snprintf (map -> nspname , sizeof (map -> nspname ), "%s" , old_rel -> nspname );
115
118
snprintf (map -> relname , sizeof (map -> relname ), "%s" , old_rel -> relname );
0 commit comments