Skip to content

Commit a31771a

Browse files
committed
Fix bug in handling tables without primary key
1 parent f4c9a73 commit a31771a

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

contrib/mmts/multimaster.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2400,15 +2400,18 @@ MtmExecutorFinish(QueryDesc *queryDesc)
24002400
for (i = 0; i < estate->es_num_result_relations; i++) {
24012401
Relation rel = estate->es_result_relations[i].ri_RelationDesc;
24022402
if (RelationNeedsWAL(rel)) {
2403+
if (MtmIgnoreTablesWithoutPk) {
2404+
if (!rel->rd_indexvalid) {
2405+
RelationGetIndexList(rel);
2406+
}
2407+
if (rel->rd_replidindex == InvalidOid) {
2408+
MtmMakeRelationLocal(RelationGetRelid(rel));
2409+
continue;
2410+
}
2411+
}
24032412
MtmTx.containsDML = true;
24042413
break;
24052414
}
2406-
if (MtmIgnoreTablesWithoutPk) {
2407-
if (!rel->rd_indexvalid) {
2408-
RelationGetIndexList(rel);
2409-
}
2410-
MtmMakeRelationLocal(rel->rd_replidindex);
2411-
}
24122415
}
24132416
}
24142417
}

0 commit comments

Comments
 (0)