@@ -936,6 +936,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
936
936
int tblnum ;
937
937
char old_cluster_pgdata [MAXPGPATH ],
938
938
new_cluster_pgdata [MAXPGPATH ];
939
+ char * old_tblspc_suffix ;
939
940
940
941
* deletion_script_file_name = psprintf ("%sdelete_old_cluster.%s" ,
941
942
SCRIPT_PREFIX , SCRIPT_EXT );
@@ -1000,39 +1001,13 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
1000
1001
fix_path_separator (old_cluster .pgdata ), PATH_QUOTE );
1001
1002
1002
1003
/* delete old cluster's alternate tablespaces */
1004
+ old_tblspc_suffix = pg_strdup (old_cluster .tablespace_suffix );
1005
+ fix_path_separator (old_tblspc_suffix );
1003
1006
for (tblnum = 0 ; tblnum < os_info .num_old_tablespaces ; tblnum ++ )
1004
- {
1005
- /*
1006
- * Do the old cluster's per-database directories share a directory
1007
- * with a new version-specific tablespace?
1008
- */
1009
- if (strlen (old_cluster .tablespace_suffix ) == 0 )
1010
- {
1011
- /* delete per-database directories */
1012
- int dbnum ;
1013
-
1014
- fprintf (script , "\n" );
1015
-
1016
- for (dbnum = 0 ; dbnum < old_cluster .dbarr .ndbs ; dbnum ++ )
1017
- fprintf (script , RMDIR_CMD " %c%s%c%u%c\n" , PATH_QUOTE ,
1018
- fix_path_separator (os_info .old_tablespaces [tblnum ]),
1019
- PATH_SEPARATOR , old_cluster .dbarr .dbs [dbnum ].db_oid ,
1020
- PATH_QUOTE );
1021
- }
1022
- else
1023
- {
1024
- char * suffix_path = pg_strdup (old_cluster .tablespace_suffix );
1025
-
1026
- /*
1027
- * Simply delete the tablespace directory, which might be ".old"
1028
- * or a version-specific subdirectory.
1029
- */
1030
- fprintf (script , RMDIR_CMD " %c%s%s%c\n" , PATH_QUOTE ,
1031
- fix_path_separator (os_info .old_tablespaces [tblnum ]),
1032
- fix_path_separator (suffix_path ), PATH_QUOTE );
1033
- pfree (suffix_path );
1034
- }
1035
- }
1007
+ fprintf (script , RMDIR_CMD " %c%s%s%c\n" , PATH_QUOTE ,
1008
+ fix_path_separator (os_info .old_tablespaces [tblnum ]),
1009
+ old_tblspc_suffix , PATH_QUOTE );
1010
+ pfree (old_tblspc_suffix );
1036
1011
1037
1012
fclose (script );
1038
1013
0 commit comments