aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2020-03-19 15:20:55 -0400
committerBruce Momjian <bruce@momjian.us>2020-03-19 15:20:55 -0400
commit2c9864e5160672274c3e94c37cfaee5cab125cbf (patch)
tree0591fe08f65b8f1b4327eae082a1019c3adb1fae /src
parent12034da6cc39373fdb378ade133aec71c7730828 (diff)
downloadpostgresql-2c9864e5160672274c3e94c37cfaee5cab125cbf.tar.gz
postgresql-2c9864e5160672274c3e94c37cfaee5cab125cbf.zip
pg_upgrade: make get_major_server_version() err msg consistent
This patch fixes the error message in get_major_server_version() to be "could not parse version file", and uses the full file path name, rather than just the data directory path. Also, commit 4109bb5de4 added the cause of the failure to the "could not open" error message, and improved quoting. This patch backpatches the "could not open" cause to PG 12, where it was first widely used, and backpatches the quoting fix in that patch to all supported releases. Reported-by: Tom Lane Discussion: https://postgr.es/m/87pne2w98h.fsf@wibble.ilmari.org Author: Dagfinn Ilmari Mannsåker Backpatch-through: 9.5
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_upgrade/server.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
index da3aefca829..c59da91f9df 100644
--- a/src/bin/pg_upgrade/server.c
+++ b/src/bin/pg_upgrade/server.c
@@ -164,12 +164,12 @@ get_major_server_version(ClusterInfo *cluster)
snprintf(ver_filename, sizeof(ver_filename), "%s/PG_VERSION",
cluster->pgdata);
if ((version_fd = fopen(ver_filename, "r")) == NULL)
- pg_fatal("could not open version file: %s\n", ver_filename);
+ pg_fatal("could not open version file \"%s\"\n", ver_filename);
if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 ||
sscanf(cluster->major_version_str, "%d.%d", &integer_version,
&fractional_version) != 2)
- pg_fatal("could not get version from %s\n", cluster->pgdata);
+ pg_fatal("could not parse version file \"%s\"\n", ver_filename);
fclose(version_fd);