From 98bd4c72fd6c4f9d6a2b3b449cb89f335116ab5a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 17 May 2023 18:55:51 +0200 Subject: [PATCH] pg_dump: Have _EndLO report errno after CFH->write_func() failure Other callers of that function do things this way, but this one didn't get the memo. --- src/bin/pg_dump/pg_backup_directory.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/pg_backup_directory.c b/src/bin/pg_dump/pg_backup_directory.c index 2177d5ff42..7f2ac7c7fd 100644 --- a/src/bin/pg_dump/pg_backup_directory.c +++ b/src/bin/pg_dump/pg_backup_directory.c @@ -697,7 +697,13 @@ _EndLO(ArchiveHandle *AH, TocEntry *te, Oid oid) /* register the LO in blobs.toc */ len = snprintf(buf, sizeof(buf), "%u blob_%u.dat\n", oid, oid); if (!CFH->write_func(buf, len, CFH)) - pg_fatal("could not write to LOs TOC file"); + { + /* if write didn't set errno, assume problem is no disk space */ + if (errno == 0) + errno = ENOSPC; + pg_fatal("could not write to LOs TOC file: %s", + CFH->get_error_func(CFH)); + } } /* -- 2.30.2