@@ -54,6 +54,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
54
54
if (strcmp (old_rel -> nspname , "pg_toast" ) == 0 )
55
55
continue ;
56
56
57
+ /* old/new non-toast relation names match */
57
58
new_rel = relarr_lookup_rel_name (& new_cluster , & new_db -> rel_arr ,
58
59
old_rel -> nspname , old_rel -> relname );
59
60
@@ -70,6 +71,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
70
71
char old_name [MAXPGPATH ], new_name [MAXPGPATH ];
71
72
RelInfo * old_toast , * new_toast ;
72
73
74
+ /* use the toast relids from the rel_arr for lookups */
73
75
old_toast = relarr_lookup_rel_oid (& old_cluster , & old_db -> rel_arr ,
74
76
old_rel -> toastrelid );
75
77
new_toast = relarr_lookup_rel_oid (& new_cluster , & new_db -> rel_arr ,
@@ -79,12 +81,7 @@ gen_db_file_maps(DbInfo *old_db, DbInfo *new_db,
79
81
old_toast , new_toast , maps + num_maps );
80
82
num_maps ++ ;
81
83
82
- /*
83
- * We also need to provide a mapping for the index of this toast
84
- * relation. The procedure is similar to what we did above for
85
- * toast relation itself, the only difference being that the
86
- * relnames need to be appended with _index.
87
- */
84
+ /* toast indexes are the same, except with an "_index" suffix */
88
85
snprintf (old_name , sizeof (old_name ), "%s_index" , old_toast -> relname );
89
86
snprintf (new_name , sizeof (new_name ), "%s_index" , new_toast -> relname );
90
87
0 commit comments