]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix some error message inconsistencies
authorMichael Paquier <michael@paquier.xyz>
Fri, 6 Feb 2026 06:38:16 +0000 (15:38 +0900)
committerMichael Paquier <michael@paquier.xyz>
Fri, 6 Feb 2026 06:38:16 +0000 (15:38 +0900)
These errors are very unlikely going to show up, but in the event that
they happen, some incorrect information would have been provided:
- In pg_rewind, a stat() failure was reported as an open() failure.
- In pg_combinebackup, a check for the new directory of a tablespace
mapping was referred as the old directory.
- In pg_combinebackup, a failure in reading a source file when copying
blocks referred to the destination file.

The changes for pg_combinebackup affect v17 and newer versions.  For
pg_rewind, all the stable branches are affected.

Author: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/tencent_1EE1430B1E6C18A663B8990F@qq.com
Backpatch-through: 14

src/bin/pg_combinebackup/copy_file.c
src/bin/pg_combinebackup/pg_combinebackup.c
src/bin/pg_rewind/file_ops.c

index dd3c0dc1c89be42466249cdd2a873fbdb8e2eafe..0287d6e87df5eefd78039828d82afeab0e5cdb3b 100644 (file)
@@ -210,7 +210,7 @@ copy_file_blocks(const char *src, const char *dst,
        }
 
        if (rb < 0)
-               pg_fatal("could not read from file \"%s\": %m", dst);
+               pg_fatal("could not read from file \"%s\": %m", src);
 
        pg_free(buffer);
        close(src_fd);
index 918b8b356461d7b14c96d4fa595b204c152f203b..b9f26ce782e476dadd5d9fc1aeb2f8557f8db47a 100644 (file)
@@ -501,7 +501,7 @@ add_tablespace_mapping(cb_options *opt, char *arg)
                                 tsmap->old_dir);
 
        if (!is_absolute_path(tsmap->new_dir))
-               pg_fatal("old directory is not an absolute path in tablespace mapping: %s",
+               pg_fatal("new directory is not an absolute path in tablespace mapping: %s",
                                 tsmap->new_dir);
 
        /* Canonicalize paths to avoid spurious failures when comparing. */
index 356e23a3080ae8b5a4128495ad14f87b3b363cf5..7de2195a4fa9df66c3859f720a3e77379665f591 100644 (file)
@@ -327,7 +327,7 @@ slurpFile(const char *datadir, const char *path, size_t *filesize)
                                 fullpath);
 
        if (fstat(fd, &statbuf) < 0)
-               pg_fatal("could not open file \"%s\" for reading: %m",
+               pg_fatal("could not stat file \"%s\" for reading: %m",
                                 fullpath);
 
        len = statbuf.st_size;