Add removal of PG_VERSION to optional old cluster deletion script.
authorBruce Momjian <[email protected]>
Tue, 19 Oct 2010 15:52:44 +0000 (15:52 +0000)
committerBruce Momjian <[email protected]>
Tue, 19 Oct 2010 15:52:44 +0000 (15:52 +0000)
Backpatch to 9.0.X.

contrib/pg_upgrade/check.c
contrib/pg_upgrade/pg_upgrade.h

index fb35507af103b11140044098ed9b2da8e28f6199..3a2922681c7715324c913ec875ea9a020f505b26 100644 (file)
@@ -416,6 +416,11 @@ create_script_for_old_cluster_deletion(migratorContext *ctx,
                        int                     dbnum;
 
                        fprintf(script, "\n");
+                       /* remove PG_VERSION? */
+                       if (GET_MAJOR_VERSION(ctx->old.major_version) <= 804)
+                               fprintf(script, RM_CMD " %s%s/PG_VERSION\n",
+                                               ctx->tablespaces[tblnum], ctx->old.tablespace_suffix);
+
                        for (dbnum = 0; dbnum < ctx->new.dbarr.ndbs; dbnum++)
                        {
                                fprintf(script, RMDIR_CMD " %s%s/%d\n",
index 144161b6378c42dd73a6e4d9bd7bc3031e433ecf..41c4b11245ae8e6f1da24004ba2b4f3ddafaf207 100644 (file)
@@ -38,6 +38,7 @@
 #define pg_copy_file           copy_file
 #define pg_mv_file                     rename
 #define pg_link_file           link
+#define RM_CMD                         "rm -f"
 #define RMDIR_CMD                      "rm -rf"
 #define SHELL_EXT                      "sh"
 #else
@@ -45,6 +46,7 @@
 #define pg_mv_file                     pgrename
 #define pg_link_file           win32_pghardlink
 #define sleep(x)                       Sleep(x * 1000)
+#define RM_CMD                         "DEL /q"
 #define RMDIR_CMD                      "RMDIR /s/q"
 #define SHELL_EXT                      "bat"
 #define EXE_EXT                                ".exe"