diff --git a/src/backend/replication/logical/conflict.c b/src/backend/replication/logical/conflict.c index f0b71a74d89..a286f616f9c 100644 --- a/src/backend/replication/logical/conflict.c +++ b/src/backend/replication/logical/conflict.c @@ -1138,7 +1138,11 @@ build_index_key_json(EState *estate, Relation localrel, continue; } - getTypeOutputInfo(att->atttypid, &outfuncoid, &typisvarlena); + /* + * See BuildIndexValueDescription() for why we used + * rd_opcintype instead index's tupleDesc. + */ + getTypeOutputInfo(indexDesc->rd_opcintype[i], &outfuncoid, &typisvarlena); outputstr = OidOutputFunctionCall(outfuncoid, values[i]); escape_json(&result, outputstr); pfree(outputstr);