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

Commitb52a4a5

Browse files
committed
Clean up error messages from1495eff
Quote file names, and mostly avoid hard coded file names. Along the waymake a few other minor improvements.Discussion:https://postgr.es/m/20250407.152721.1397761902317499205.horikyota.ntt@gmail.com
1 parent3516ea7 commitb52a4a5

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

‎src/bin/pg_dump/pg_dumpall.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ main(int argc, char *argv[])
523523

524524
OPF=fopen(global_path,PG_BINARY_W);
525525
if (!OPF)
526-
pg_fatal("could not openglobal.dat file: %s",strerror(errno));
526+
pg_fatal("could not open\"%s\": %m",global_path);
527527
}
528528
elseif (filename)
529529
{

‎src/bin/pg_dump/pg_restore.c‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,7 +1035,7 @@ get_dbname_oid_list_from_mfile(const char *dumpdirpath, SimpleOidStringList *dbn
10351035
*/
10361036
if (!file_exists_in_directory(dumpdirpath,"map.dat"))
10371037
{
1038-
pg_log_info("databases restoring is skipped as map.dat file is not present in \"%s\"",dumpdirpath);
1038+
pg_log_info("database restoring is skipped as\"map.dat\" is not present in \"%s\"",dumpdirpath);
10391039
return0;
10401040
}
10411041

@@ -1045,7 +1045,7 @@ get_dbname_oid_list_from_mfile(const char *dumpdirpath, SimpleOidStringList *dbn
10451045
pfile=fopen(map_file_path,PG_BINARY_R);
10461046

10471047
if (pfile==NULL)
1048-
pg_fatal("could not openmap.dat file:\"%s\"",map_file_path);
1048+
pg_fatal("could not open \"%s\": %m",map_file_path);
10491049

10501050
/* Append all the dbname/db_oid combinations to the list. */
10511051
while ((fgets(line,MAXPGPATH,pfile))!=NULL)
@@ -1064,11 +1064,13 @@ get_dbname_oid_list_from_mfile(const char *dumpdirpath, SimpleOidStringList *dbn
10641064
/* Remove \n from dbname. */
10651065
dbname[strlen(dbname)-1]='\0';
10661066

1067-
pg_log_info("found database \"%s\" (OID: %u) in map.dat file while restoring.",dbname,db_oid);
1067+
pg_log_info("found database \"%s\" (OID: %u) in \"%s\"",
1068+
dbname,db_oid,map_file_path);
10681069

10691070
/* Report error and exit if the file has any corrupted data. */
10701071
if (!OidIsValid(db_oid)||strlen(dbname)==0)
1071-
pg_fatal("invalid entry in map.dat file at line : %d",count+1);
1072+
pg_fatal("invalid entry in \"%s\" at line : %d",map_file_path,
1073+
count+1);
10721074

10731075
simple_oid_string_list_append(dbname_oid_list,db_oid,dbname);
10741076
count++;
@@ -1116,7 +1118,7 @@ restore_all_databases(PGconn *conn, const char *dumpdirpath,
11161118
if (dbname_oid_list.head==NULL)
11171119
returnprocess_global_sql_commands(conn,dumpdirpath,opts->filename);
11181120

1119-
pg_log_info("foundtotal%d database names in map.dat file",num_total_db);
1121+
pg_log_info("found %d database names in\"map.dat\"",num_total_db);
11201122

11211123
if (!conn)
11221124
{
@@ -1288,7 +1290,7 @@ process_global_sql_commands(PGconn *conn, const char *dumpdirpath, const char *o
12881290
pfile=fopen(global_file_path,PG_BINARY_R);
12891291

12901292
if (pfile==NULL)
1291-
pg_fatal("could not openglobal.dat file:\"%s\"",global_file_path);
1293+
pg_fatal("could not open \"%s\": %m",global_file_path);
12921294

12931295
/*
12941296
* If outfile is given, then just copy all global.dat file data into
@@ -1335,7 +1337,7 @@ process_global_sql_commands(PGconn *conn, const char *dumpdirpath, const char *o
13351337

13361338
/* Print a summary of ignored errors during global.dat. */
13371339
if (n_errors)
1338-
pg_log_warning("errorsignoredon global.dat file restore: %d",n_errors);
1340+
pg_log_warning("ignored%d errors in \"%s\"",n_errors,global_file_path);
13391341

13401342
fclose(pfile);
13411343

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp