From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@postgresql.org
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Kunshchikov Vladimir <Vladimir.Kunshchikov@infotecs.ru>
Subject: pg_dump, gzwrite, and errno
Date: Thu, 11 Jun 2020 10:37:53 -0500
Message-ID: <20200611153753.GU14879@telsasoft.com> (raw)
While testing Pavel's patch for pg_dump --filter, I got:
pg_dump: error: could not write to output file: Success
[pryzbyj@database postgresql]$ echo $?
1
I see we tried to fix it few years ago:
https://www.postgresql.org/message-id/flat/1498120508308.9826%40infotecs.ruhttps://www.postgresql.org/message-id/flat/20160125143008.2539.2878%40wrigleys.postgresql.orghttps://www.postgresql.org/message-id/20160307.174354.251049100.horiguchi.kyotaro@lab.ntt.co.jphttps://www.postgresql.org/message-id/20150608174336.GM133018@postgresql.org
Commits:
4d57e83816778c6f61ea35c697f937a6f9c3c3de
9a3b5d3ad0f1c19c47e2ee65b372344cb0616c9a
This patch fixes it for me
pg_dump: error: could not write to output file: No space left on device
inline patch 1: src/bin/pg_dump/pg_backup_directory.c (+4/-0 lines) download inline-1.patch--- a/src/bin/pg_dump/pg_backup_directory.c+++ b/src/bin/pg_dump/pg_backup_directory.c@@ -347,8 +347,12 @@ _WriteData(ArchiveHandle *AH, const void *data, size_t dLen)
lclContext *ctx = (lclContext *) AH->formatData;
if (dLen > 0 && cfwrite(data, dLen, ctx->dataFH) != dLen)
+ {+ if (errno == 0)+ errno = ENOSPC;
fatal("could not write to output file: %s",
get_cfp_error(ctx->dataFH));
+ }
}
PS. Due to $UserError, I originally sent this message with inaccurate RFC822
headers..
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: pryzby@telsasoft.com, alvherre@2ndquadrant.com, Vladimir.Kunshchikov@infotecs.ru
Subject: Re: pg_dump, gzwrite, and errno
In-Reply-To: <20200611153753.GU14879@telsasoft.com>
* 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