aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistbuildbuffers.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/gist/gistbuildbuffers.c')
-rw-r--r--src/backend/access/gist/gistbuildbuffers.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/backend/access/gist/gistbuildbuffers.c b/src/backend/access/gist/gistbuildbuffers.c
index 4b562d8d3f0..4eab9bb83ac 100644
--- a/src/backend/access/gist/gistbuildbuffers.c
+++ b/src/backend/access/gist/gistbuildbuffers.c
@@ -757,26 +757,20 @@ gistRelocateBuildBuffersOnSplit(GISTBuildBuffers *gfbb, GISTSTATE *giststate,
static void
ReadTempFileBlock(BufFile *file, long blknum, void *ptr)
{
+ size_t nread;
+
if (BufFileSeekBlock(file, blknum) != 0)
- elog(ERROR, "could not seek temporary file: %m");
- if (BufFileRead(file, ptr, BLCKSZ) != BLCKSZ)
- elog(ERROR, "could not read temporary file: %m");
+ elog(ERROR, "could not seek to block %ld in temporary file", blknum);
+ nread = BufFileRead(file, ptr, BLCKSZ);
+ if (nread != BLCKSZ)
+ elog(ERROR, "could not read temporary file: read only %zu of %zu bytes",
+ nread, (size_t) BLCKSZ);
}
static void
WriteTempFileBlock(BufFile *file, long blknum, void *ptr)
{
if (BufFileSeekBlock(file, blknum) != 0)
- elog(ERROR, "could not seek temporary file: %m");
- if (BufFileWrite(file, ptr, BLCKSZ) != BLCKSZ)
- {
- /*
- * the other errors in Read/WriteTempFileBlock shouldn't happen, but
- * an error at write can easily happen if you run out of disk space.
- */
- ereport(ERROR,
- (errcode_for_file_access(),
- errmsg("could not write block %ld of temporary file: %m",
- blknum)));
- }
+ elog(ERROR, "could not seek to block %ld in temporary file", blknum);
+ BufFileWrite(file, ptr, BLCKSZ);
}