Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite4c3c99

Browse files
committed
pg_upgrade: error if run from top of new PGDATA on Windows
Print a clear error message in this case, rather than wait for initdb--sync-only to generate a "Permission denied" error.
1 parentef153ec commite4c3c99

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎contrib/pg_upgrade/option.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,26 @@ parseCommandLine(int argc, char *argv[])
229229
"PGDATAOLD","-d","old cluster data resides");
230230
check_required_directory(&new_cluster.pgdata,&new_cluster.pgconfig,
231231
"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
232252
}
233253

234254

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp