Skip to content

Commit 9f62ea2

Browse files
committed
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 4109bb5 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
1 parent fdaa16a commit 9f62ea2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/bin/pg_upgrade/server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,11 @@ get_major_server_version(ClusterInfo *cluster)
165165
snprintf(ver_filename, sizeof(ver_filename), "%s/PG_VERSION",
166166
cluster->pgdata);
167167
if ((version_fd = fopen(ver_filename, "r")) == NULL)
168-
pg_fatal("could not open version file: %s\n", ver_filename);
168+
pg_fatal("could not open version file \"%s\": %m\n", ver_filename);
169169

170170
if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 ||
171171
sscanf(cluster->major_version_str, "%d.%d", &v1, &v2) < 1)
172-
pg_fatal("could not parse PG_VERSION file from %s\n", cluster->pgdata);
172+
pg_fatal("could not parse version file \"%s\"\n", ver_filename);
173173

174174
fclose(version_fd);
175175

0 commit comments

Comments
 (0)