@@ -220,9 +220,16 @@ transfer_relfile(FileNameMap *map, const char *type_suffix, bool vm_must_add_fro
220
220
char old_file [MAXPGPATH ];
221
221
char new_file [MAXPGPATH ];
222
222
int segno ;
223
- char extent_suffix [65 ];
223
+ char segno_text [65 ];
224
+ char const * extent_prefix = "" ;
225
+ char const * extent_suffix = "" ;
224
226
struct stat statbuf ;
225
227
228
+ if (strcmp (type_suffix , ".cfm" ) == 0 )
229
+ extent_prefix = segno_text ;
230
+ else
231
+ extent_suffix = segno_text ;
232
+
226
233
/*
227
234
* Now copy/link any related segments as well. Remember, PG breaks large
228
235
* files into 1GB segments, the first segment has no extension, subsequent
@@ -231,22 +238,24 @@ transfer_relfile(FileNameMap *map, const char *type_suffix, bool vm_must_add_fro
231
238
for (segno = 0 ;; segno ++ )
232
239
{
233
240
if (segno == 0 )
234
- extent_suffix [0 ] = '\0' ;
241
+ segno_text [0 ] = '\0' ;
235
242
else
236
- snprintf (extent_suffix , sizeof (extent_suffix ), ".%d" , segno );
243
+ snprintf (segno_text , sizeof (segno_text ), ".%d" , segno );
237
244
238
- snprintf (old_file , sizeof (old_file ), "%s%s/%u/%u%s%s" ,
245
+ snprintf (old_file , sizeof (old_file ), "%s%s/%u/%u%s%s%s " ,
239
246
map -> old_tablespace ,
240
247
map -> old_tablespace_suffix ,
241
248
map -> old_db_oid ,
242
249
map -> old_relfilenode ,
250
+ extent_prefix ,
243
251
type_suffix ,
244
252
extent_suffix );
245
- snprintf (new_file , sizeof (new_file ), "%s%s/%u/%u%s%s" ,
253
+ snprintf (new_file , sizeof (new_file ), "%s%s/%u/%u%s%s%s " ,
246
254
map -> new_tablespace ,
247
255
map -> new_tablespace_suffix ,
248
256
map -> new_db_oid ,
249
257
map -> new_relfilenode ,
258
+ extent_prefix ,
250
259
type_suffix ,
251
260
extent_suffix );
252
261
0 commit comments