aboutsummaryrefslogtreecommitdiff
path: root/src/backend/replication/logical/reorderbuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/logical/reorderbuffer.c')
-rw-r--r--src/backend/replication/logical/reorderbuffer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c
index 9594b1c671b..213ce34674c 100644
--- a/src/backend/replication/logical/reorderbuffer.c
+++ b/src/backend/replication/logical/reorderbuffer.c
@@ -2317,7 +2317,10 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
if (write(fd, rb->outbuf, ondisk->size) != ondisk->size)
{
+ int save_errno = errno;
+
CloseTransientFile(fd);
+ errno = save_errno;
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not write to data file for XID %u: %m",
@@ -3070,7 +3073,8 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
fd = OpenTransientFile(path, O_RDONLY | PG_BINARY, 0);
if (fd < 0)
ereport(ERROR,
- (errmsg("could not open file \"%s\": %m", path)));
+ (errcode_for_file_access(),
+ errmsg("could not open file \"%s\": %m", path)));
while (true)
{