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

Commitac7238d

Browse files
committed
Improve error reporting when location specified by postgres -D does not exist
Previously, the first error seen would be that postgresql.conf does notexist. But for the case where the whole directory does not exist, givean error message about that, together with a hint for how to create one.
1 parent2808a2e commitac7238d

File tree

1 file changed

+12
-1
lines changed
  • src/backend/utils/misc

1 file changed

+12
-1
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4463,6 +4463,17 @@ SelectConfigFiles(const char *userDoption, const char *progname)
44634463
else
44644464
configdir=make_absolute_path(getenv("PGDATA"));
44654465

4466+
if (configdir&&stat(configdir,&stat_buf)!=0)
4467+
{
4468+
write_stderr("%s: could not access \"%s\": %s\n",
4469+
progname,
4470+
configdir,
4471+
strerror(errno));
4472+
if (errno==ENOENT)
4473+
write_stderr("Run initdb or pg_basebackup to initialize a PostgreSQL data directory.\n");
4474+
return false;
4475+
}
4476+
44664477
/*
44674478
* Find the configuration file: if config_file was specified on the
44684479
* command line, use it, else use configdir/postgresql.conf. In any case
@@ -4498,7 +4509,7 @@ SelectConfigFiles(const char *userDoption, const char *progname)
44984509
*/
44994510
if (stat(ConfigFileName,&stat_buf)!=0)
45004511
{
4501-
write_stderr("%s cannot access the server configuration file \"%s\": %s\n",
4512+
write_stderr("%s: could not access the server configuration file \"%s\": %s\n",
45024513
progname,ConfigFileName,strerror(errno));
45034514
free(configdir);
45044515
return false;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp