Skip to content

Commit 9ecd51d

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 e20523f commit 9ecd51d

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
@@ -681,7 +681,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
681681
#endif
682682

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

686686
/* delete old cluster's alternate tablespaces */
687687
for (tblnum = 0; tblnum < os_info.num_old_tablespaces; tblnum++)
@@ -705,7 +705,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
705705

706706
for (dbnum = 0; dbnum < old_cluster.dbarr.ndbs; dbnum++)
707707
{
708-
fprintf(script, RMDIR_CMD " %s%s%c%d\n",
708+
fprintf(script, RMDIR_CMD " \"%s%s%c%d\"\n",
709709
fix_path_separator(os_info.old_tablespaces[tblnum]),
710710
fix_path_separator(old_cluster.tablespace_suffix),
711711
PATH_SEPARATOR, old_cluster.dbarr.dbs[dbnum].db_oid);
@@ -717,7 +717,7 @@ create_script_for_old_cluster_deletion(char **deletion_script_file_name)
717717
* Simply delete the tablespace directory, which might be ".old"
718718
* or a version-specific subdirectory.
719719
*/
720-
fprintf(script, RMDIR_CMD " %s%s\n",
720+
fprintf(script, RMDIR_CMD " \"%s%s\"\n",
721721
fix_path_separator(os_info.old_tablespaces[tblnum]),
722722
fix_path_separator(old_cluster.tablespace_suffix));
723723
}

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