aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xloginsert.c
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2023-08-12 14:37:05 -0700
committerNoah Misch <noah@leadboat.com>2023-08-12 14:37:05 -0700
commitc36b636096a1aac4fd5d7c8c5d11ed2bb6349d0f (patch)
treee7825e4bcb8e5dd3f8e526882bdbd0443742600b /src/backend/access/transam/xloginsert.c
parent638d42a3c52081cf4882520f0622161bad69b40f (diff)
downloadpostgresql-c36b636096a1aac4fd5d7c8c5d11ed2bb6349d0f.tar.gz
postgresql-c36b636096a1aac4fd5d7c8c5d11ed2bb6349d0f.zip
Fix off-by-one in XLogRecordMaxSize check.
pg_logical_emit_message(false, '_', repeat('x', 1069547465)) failed with self-contradictory message "WAL record would be 1069547520 bytes (of maximum 1069547520 bytes)". There's no particular benefit from allowing or denying one byte in either direction; XLogRecordMaxSize could rise a few megabytes without trouble. Hence, this is just for cleanliness. Back-patch to v16, where this check first appeared.
Diffstat (limited to 'src/backend/access/transam/xloginsert.c')
-rw-r--r--src/backend/access/transam/xloginsert.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/transam/xloginsert.c b/src/backend/access/transam/xloginsert.c
index 54247e1d81b..258cbd70355 100644
--- a/src/backend/access/transam/xloginsert.c
+++ b/src/backend/access/transam/xloginsert.c
@@ -900,7 +900,7 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
* not emit records larger than the sizes advertised to be supported. This
* cap is based on DecodeXLogRecordRequiredSpace().
*/
- if (total_len >= XLogRecordMaxSize)
+ if (total_len > XLogRecordMaxSize)
ereport(ERROR,
(errmsg_internal("oversized WAL record"),
errdetail_internal("WAL record would be %llu bytes (of maximum %u bytes); rmid %u flags %u.",