apply_handle_tuple_routing(edata,
remoteslot, NULL, CMD_INSERT);
else
- apply_handle_insert_internal(edata, edata->targetRelInfo,
- remoteslot);
+ {
+ ResultRelInfo *relinfo = edata->targetRelInfo;
+
+ ExecOpenIndices(relinfo, true);
+ apply_handle_insert_internal(edata, relinfo, remoteslot);
+ ExecCloseIndices(relinfo);
+ }
finish_edata(edata);
{
EState *estate = edata->estate;
- /* We must open indexes here. */
- ExecOpenIndices(relinfo, true);
+ /* Caller should have opened indexes already. */
+ Assert(relinfo->ri_IndexRelationDescs != NULL ||
+ !relinfo->ri_RelationDesc->rd_rel->relhasindex ||
+ RelationGetIndexList(relinfo->ri_RelationDesc) == NIL);
+
+ /* Caller will not have done this bit. */
+ Assert(relinfo->ri_onConflictArbiterIndexes == NIL);
InitConflictIndexes(relinfo);
/* Do the insert. */
TargetPrivilegesCheck(relinfo->ri_RelationDesc, ACL_INSERT);
ExecSimpleRelationInsert(relinfo, estate, remoteslot);
-
- /* Cleanup. */
- ExecCloseIndices(relinfo);
}
/*
apply_handle_tuple_routing(edata,
remoteslot, NULL, CMD_DELETE);
else
- apply_handle_delete_internal(edata, edata->targetRelInfo,
+ {
+ ResultRelInfo *relinfo = edata->targetRelInfo;
+
+ ExecOpenIndices(relinfo, false);
+ apply_handle_delete_internal(edata, relinfo,
remoteslot, rel->localindexoid);
+ ExecCloseIndices(relinfo);
+ }
finish_edata(edata);
bool found;
EvalPlanQualInit(&epqstate, estate, NULL, NIL, -1, NIL);
- ExecOpenIndices(relinfo, false);
+
+ /* Caller should have opened indexes already. */
+ Assert(relinfo->ri_IndexRelationDescs != NULL ||
+ !localrel->rd_rel->relhasindex ||
+ RelationGetIndexList(localrel) == NIL);
found = FindReplTupleInLocalRel(edata, localrel, remoterel, localindexoid,
remoteslot, &localslot);
}
/* Cleanup. */
- ExecCloseIndices(relinfo);
EvalPlanQualEnd(&epqstate);
}
* work already done above to find the local tuple in the
* partition.
*/
- ExecOpenIndices(partrelinfo, true);
InitConflictIndexes(partrelinfo);
EvalPlanQualSetSlot(&epqstate, remoteslot_part);
get_namespace_name(RelationGetNamespace(partrel_new)),
RelationGetRelationName(partrel_new));
- ExecOpenIndices(partrelinfo, false);
-
/* DELETE old tuple found in the old partition. */
EvalPlanQualSetSlot(&epqstate, localslot);
TargetPrivilegesCheck(partrelinfo->ri_RelationDesc, ACL_DELETE);
remoteslot_part);
}
- ExecCloseIndices(partrelinfo);
EvalPlanQualEnd(&epqstate);
}
break;