Skip to content

Commit 74a1082

Browse files
committed
Fix memory coruption on multicolumn primary keys
1 parent f8ef797 commit 74a1082

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

pglogical_conflict.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,13 @@ pglogical_tuple_find_replidx(EState *estate, PGLogicalTupleData *tuple,
226226
ResultRelInfo *relinfo = estate->es_result_relation_info;
227227
Relation idxrel = replindex_open(relinfo->ri_RelationDesc,
228228
RowExclusiveLock);
229-
ScanKeyData index_key;
229+
ScanKeyData index_key[INDEX_MAX_KEYS];
230230
bool found;
231231

232-
build_index_scan_key(&index_key, relinfo->ri_RelationDesc, idxrel, tuple);
232+
build_index_scan_key(index_key, relinfo->ri_RelationDesc, idxrel, tuple);
233233

234234
/* Try to find the row. */
235-
found = find_index_tuple(&index_key, relinfo->ri_RelationDesc, idxrel,
235+
found = find_index_tuple(index_key, relinfo->ri_RelationDesc, idxrel,
236236
LockTupleExclusive, oldslot);
237237

238238
/* Don't release lock until commit. */
@@ -249,7 +249,7 @@ pglogical_tuple_find_conflict(EState *estate, PGLogicalTupleData *tuple,
249249
TupleTableSlot *oldslot)
250250
{
251251
Oid conflict_idx = InvalidOid;
252-
ScanKeyData index_key;
252+
ScanKeyData index_key[INDEX_MAX_KEYS];
253253
int i;
254254
ResultRelInfo *relinfo;
255255
ItemPointerData conflicting_tid;
@@ -275,12 +275,12 @@ pglogical_tuple_find_conflict(EState *estate, PGLogicalTupleData *tuple,
275275

276276
idxrel = relinfo->ri_IndexRelationDescs[i];
277277

278-
if (build_index_scan_key(&index_key, relinfo->ri_RelationDesc,
279-
idxrel, tuple))
278+
if (build_index_scan_key(index_key, relinfo->ri_RelationDesc,
279+
idxrel, tuple))
280280
continue;
281281

282282
/* Try to find conflicting row. */
283-
found = find_index_tuple(&index_key, relinfo->ri_RelationDesc,
283+
found = find_index_tuple(index_key, relinfo->ri_RelationDesc,
284284
idxrel, LockTupleExclusive, oldslot);
285285

286286
/* Alert if there's more than one conflicting unique key, we can't

0 commit comments

Comments
 (0)