We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentef153ec commite4c3c99Copy full SHA for e4c3c99
contrib/pg_upgrade/option.c
@@ -229,6 +229,26 @@ parseCommandLine(int argc, char *argv[])
229
"PGDATAOLD","-d","old cluster data resides");
230
check_required_directory(&new_cluster.pgdata,&new_cluster.pgconfig,
231
"PGDATANEW","-D","new cluster data resides");
232
+
233
+#ifndefWIN32
234
+/*
235
+ * On Windows, initdb --sync-only will fail with a "Permission denied"
236
+ * error on file pg_upgrade_utility.log if pg_upgrade is run inside
237
+ * the new cluster directory, so we do a check here.
238
+ */
239
+{
240
+charcwd[MAXPGPATH],new_cluster_pgdata[MAXPGPATH];
241
242
+strlcpy(new_cluster_pgdata,new_cluster.pgdata,MAXPGPATH);
243
+canonicalize_path(new_cluster_pgdata);
244
245
+if (!getcwd(cwd,MAXPGPATH))
246
+pg_fatal("cannot find current directory\n");
247
+canonicalize_path(cwd);
248
+if (path_is_prefix_of_path(new_cluster_pgdata,cwd))
249
+pg_fatal("cannot run pg_upgrade from inside the new cluster data directory on Windows\n");
250
+}
251
+#endif
252
}
253
254