pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ilmari@ilmari.org
To: pgsql-hackers@lists.postgresql.org
Subject: [PATCH] pg_upgrade: report the reason for failing to open the cluster version file
Date: Tue, 25 Feb 2020 23:14:06 +0000
Message-ID: <87pne2w98h.fsf@wibble.ilmari.org> (raw)

Hi Hackers,

The other day I was helping someone with pg_upgrade on IRC, and they got
a rather unhelpful error message:

  ERROR: could not open version file /path/to/new/cluster/PG_VERSION

It would have saved some minutes of debugging time if that had included
the reason why the open failed, so here's a patch to do so.

- ilmari
-- 
- Twitter seems more influential [than blogs] in the 'gets reported in
  the mainstream press' sense at least.               - Matt McLeod
- That'd be because the content of a tweet is easier to condense down
  to a mainstream media article.                      - Calle Dybedahl

Attachments:

0001-pg_upgrade-add-m-to-version-file-open-failure-messag.patch (text/x-diff, 1005B) download From 84b99582a3447213f666c2f6f52c22ef518d82d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org> Date: Tue, 25 Feb 2020 18:07:14 +0000 Subject: [PATCH] pg_upgrade: add %m to version file open failure message --- src/bin/pg_upgrade/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c index e244256501..c9b56ae175 100644 --- a/src/bin/pg_upgrade/server.c +++ b/src/bin/pg_upgrade/server.c @@ -164,7 +164,7 @@ 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\": %m\n", ver_filename); if (fscanf(version_fd, "%63s", cluster->major_version_str) == 0 || sscanf(cluster->major_version_str, "%d.%d", &v1, &v2) < 1) -- 2.22.0

view thread (11+ messages)  latest in thread

Message-ID: <87pne2w98h.fsf@wibble.ilmari.org>
Permalink:  ../87pne2w98h.fsf@wibble.ilmari.org/
Also on:    postgresql.org/message-id/87pne2w98h.fsf@wibble.ilmari.org

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ilmari@ilmari.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: [PATCH] pg_upgrade: report the reason for failing to open the cluster version file
  In-Reply-To: <87pne2w98h.fsf@wibble.ilmari.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox