Hello. While translating error messages related to pg_dumpall (1495eff7bdb), I noticed that one message lacks double quotes around the file name:
could not open map file: %s Since this placeholder appears standalone and not embedded in a sentence, I initially thought it might fall outside the usual convention of quoting file names. However, a similar message added to pg_restore does quote the file name, as in: could not open global.dat file: "%s" So I believe this omission is unintentional. The first of the attached patches adds double quotes around the file name for consistency. In addition, I noticed that pg_dump and pg_restore refer to map.dat using different wording. The second patch updates the message to refer to "map.dat file" instead of "map file", for consistency with how pg_restore refers to both "global.dat file" and "map.dat file" explicitly. I noticed that there are other messages in other files that refer to file names without quotes as well, but I'm not addressing those here. regards. -- Kyotaro Horiguchi NTT Open Source Software Center
>From 9752e745322f7c8d2be68aa982546aaac8074f75 Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyota....@gmail.com> Date: Mon, 7 Apr 2025 14:33:14 +0900 Subject: [PATCH 1/2] Quote file names in error messages Correct omission of double quotes around file names in newly-added error messages. --- src/bin/pg_dump/pg_dumpall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index cdb8d84f064..c112d5d22b8 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -523,7 +523,7 @@ main(int argc, char *argv[]) OPF = fopen(global_path, PG_BINARY_W); if (!OPF) - pg_fatal("could not open global.dat file: %s", strerror(errno)); + pg_fatal("could not open global.dat file: \"%s\"", strerror(errno)); } else if (filename) { @@ -1663,7 +1663,7 @@ dumpDatabases(PGconn *conn, ArchiveFormat archDumpFormat) /* Create a map file (to store dboid and dbname) */ map_file = fopen(map_file_path, PG_BINARY_W); if (!map_file) - pg_fatal("could not open map file: %s", strerror(errno)); + pg_fatal("could not open map file: \"%s\"", strerror(errno)); } for (i = 0; i < PQntuples(res); i++) -- 2.43.5
>From 02db0d55997580a9b4fd46a52e7da4802e76ecee Mon Sep 17 00:00:00 2001 From: Kyotaro Horiguchi <horikyota....@gmail.com> Date: Mon, 7 Apr 2025 15:03:46 +0900 Subject: [PATCH 2/2] Use "map.dat file" instead of "map file" in error messages While pg_restore refers to "map.dat file" and "global.dat file" explicitly, pg_dump uses the more generic term "map file". Update the wording to consistently refer to the file as "map.dat file" in error messages. --- src/bin/pg_dump/pg_dumpall.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index c112d5d22b8..71978d556aa 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -1660,10 +1660,10 @@ dumpDatabases(PGconn *conn, ArchiveFormat archDumpFormat) snprintf(map_file_path, MAXPGPATH, "%s/map.dat", filename); - /* Create a map file (to store dboid and dbname) */ + /* Create a map.dat file (to store dboid and dbname) */ map_file = fopen(map_file_path, PG_BINARY_W); if (!map_file) - pg_fatal("could not open map file: \"%s\"", strerror(errno)); + pg_fatal("could not open map.dat file: \"%s\"", strerror(errno)); } for (i = 0; i < PQntuples(res); i++) @@ -1697,7 +1697,7 @@ dumpDatabases(PGconn *conn, ArchiveFormat archDumpFormat) else snprintf(dbfilepath, MAXPGPATH, "\"%s\"/\"%s\"", db_subdir, oid); - /* Put one line entry for dboid and dbname in map file. */ + /* Put one line entry for dboid and dbname in map.dat file. */ fprintf(map_file, "%s %s\n", oid, dbname); } @@ -1748,7 +1748,7 @@ dumpDatabases(PGconn *conn, ArchiveFormat archDumpFormat) } } - /* Close map file */ + /* Close map.dat file */ if (archDumpFormat != archNull) fclose(map_file); -- 2.43.5