From e865deccc0b3a0f64af8bba5f95fafce7997ccfa Mon Sep 17 00:00:00 2001 From: Shveta Malik Date: Wed, 7 Oct 2026 14:27:23 +0530 Subject: [PATCH] Fix Ri output overflow bug. --- src/backend/replication/logical/conflict.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c index 907dc2caeaf..782a4e16a11 100644 --- a/src/backend/replication/logical/conflict.c +++ b/src/backend/replication/logical/conflict.c @@ -1090,6 +1090,7 @@ build_index_key_json(Relation localrel, Oid indexid, bool typisvarlena; char *outputstr; Size rawsize = 0; + Size outputlen = 0; /* * Don't record a value larger than CONFLICT_MAX_VALUE_SIZE; put a @@ -1126,6 +1127,18 @@ build_index_key_json(Relation localrel, Oid indexid, getTypeOutputInfo(att->atttypid, &outfuncoid, &typisvarlena); outputstr = OidOutputFunctionCall(outfuncoid, val); + outputlen = strlen(outputstr); + + if (outputlen > CONFLICT_MAX_VALUE_SIZE) + { + appendStringInfo(&result, + "{\"omitted\":true,\"length\":" UINT64_FORMAT "}", + (uint64) outputlen); + *omitted = true; + pfree(outputstr); + continue; + } + escape_json(&result, outputstr); pfree(outputstr); } -- 2.34.1