Skip to content

Commit 5eef3c6

Browse files
committed
pg_upgrade: quote directory names in delete_old_cluster script
This allows the delete script to properly function when special characters appear in directory paths, e.g. spaces. Backpatch through 9.0
1 parent c7bc5be commit 5eef3c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contrib/pg_upgrade/check.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
641641
#endif
642642

643643
/* delete old cluster's default tablespace */
644-
fprintf(script, RMDIR_CMD " %s\n", fix_path_separator(old_cluster.pgdata));
644+
fprintf(script, RMDIR_CMD " \"%s\"\n", fix_path_separator(old_cluster.pgdata));
645645

646646
/* delete old cluster's alternate tablespaces */
647647
for (tblnum = 0; tblnum < os_info.num_old_tablespaces; tblnum++)
@@ -663,7 +663,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
663663
PATH_SEPARATOR);
664664

665665
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
666-
fprintf(script, RMDIR_CMD " %s%c%d\n",
666+
fprintf(script, RMDIR_CMD " \"%s%c%d\"\n",
667667
fix_path_separator(os_info.old_tablespaces[tblnum]),
668668
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid);
669669
}
@@ -675,7 +675,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
675675
* Simply delete the tablespace directory, which might be ".old"
676676
* or a version-specific subdirectory.
677677
*/
678-
fprintf(script, RMDIR_CMD " %s%s\n",
678+
fprintf(script, RMDIR_CMD " \"%s%s\"\n",
679679
fix_path_separator(os_info.old_tablespaces[tblnum]),
680680
fix_path_separator(suffix_path));
681681
pfree(suffix_path);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy