Skip to content

Commit 66f5217

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 d99cf27 commit 66f5217

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
@@ -656,7 +656,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
656656
#endif
657657

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

661661
/* delete old cluster's alternate tablespaces */
662662
for (tblnum = 0; tblnum < os_info.num_tablespaces; tblnum++)
@@ -680,7 +680,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
680680

681681
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
682682
{
683-
fprintf(script, RMDIR_CMD " %s%s%c%d\n",
683+
fprintf(script, RMDIR_CMD " \"%s%s%c%d\"\n",
684684
fix_path_separator(os_info.tablespaces[tblnum]),
685685
fix_path_separator(old_cluster.tablespace_suffix),
686686
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid);
@@ -692,7 +692,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
692692
* Simply delete the tablespace directory, which might be ".old"
693693
* or a version-specific subdirectory.
694694
*/
695-
fprintf(script, RMDIR_CMD " %s%s\n",
695+
fprintf(script, RMDIR_CMD " \"%s%s\"\n",
696696
fix_path_separator(os_info.tablespaces[tblnum]),
697697
fix_path_separator(old_cluster.tablespace_suffix));
698698
}

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