aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/common/detoast.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/common/detoast.c b/src/backend/access/common/detoast.c
index 61d7e64c449..6341107e882 100644
--- a/src/backend/access/common/detoast.c
+++ b/src/backend/access/common/detoast.c
@@ -443,7 +443,7 @@ toast_fetch_datum(struct varlena *attr)
toast_pointer.va_valueid,
RelationGetRelationName(toastrel))));
expected_size = curchunk < totalchunks - 1 ? TOAST_MAX_CHUNK_SIZE
- : attrsize % TOAST_MAX_CHUNK_SIZE;
+ : attrsize - ((totalchunks - 1) * TOAST_MAX_CHUNK_SIZE);
if (chunksize != expected_size)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),
@@ -676,7 +676,7 @@ toast_fetch_datum_slice(struct varlena *attr, int32 sliceoffset,
toast_pointer.va_valueid,
RelationGetRelationName(toastrel))));
expected_size = curchunk < totalchunks - 1 ? TOAST_MAX_CHUNK_SIZE
- : attrsize % TOAST_MAX_CHUNK_SIZE;
+ : attrsize - ((totalchunks - 1) * TOAST_MAX_CHUNK_SIZE);
if (chunksize != expected_size)
ereport(ERROR,
(errcode(ERRCODE_DATA_CORRUPTED),