Commit a04daa97 authored by Heikki Linnakangas's avatar Heikki Linnakangas

Remove es_result_relation_info from EState.

Maintaining 'es_result_relation_info' correctly at all times has become
cumbersome, especially with partitioning where each partition gets its
own result relation info. Having to set and reset it across arbitrary
operations has caused bugs in the past.

This changes all the places that used 'es_result_relation_info', to
receive the currently active ResultRelInfo via function parameters
instead.

Author: Amit Langote
Discussion: https://www.postgresql.org/message-id/CA%2BHiwqGEmiib8FLiHMhKB%2BCH5dRgHSLc5N5wnvc4kym%2BZYpQEQ%40mail.gmail.com
parent 178f2d56
...@@ -2489,9 +2489,6 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, ...@@ -2489,9 +2489,6 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo,
ResultRelInfo *resultRelInfo = buffer->resultRelInfo; ResultRelInfo *resultRelInfo = buffer->resultRelInfo;
TupleTableSlot **slots = buffer->slots; TupleTableSlot **slots = buffer->slots;
/* Set es_result_relation_info to the ResultRelInfo we're flushing. */
estate->es_result_relation_info = resultRelInfo;
/* /*
* Print error context information correctly, if one of the operations * Print error context information correctly, if one of the operations
* below fail. * below fail.
...@@ -2524,7 +2521,8 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo, ...@@ -2524,7 +2521,8 @@ CopyMultiInsertBufferFlush(CopyMultiInsertInfo *miinfo,
cstate->cur_lineno = buffer->linenos[i]; cstate->cur_lineno = buffer->linenos[i];
recheckIndexes = recheckIndexes =
ExecInsertIndexTuples(buffer->slots[i], estate, false, NULL, ExecInsertIndexTuples(resultRelInfo,
buffer->slots[i], estate, false, NULL,
NIL); NIL);
ExecARInsertTriggers(estate, resultRelInfo, ExecARInsertTriggers(estate, resultRelInfo,
slots[i], recheckIndexes, slots[i], recheckIndexes,
...@@ -2839,8 +2837,6 @@ CopyFrom(CopyState cstate) ...@@ -2839,8 +2837,6 @@ CopyFrom(CopyState cstate)
ExecOpenIndices(resultRelInfo, false); ExecOpenIndices(resultRelInfo, false);
estate->es_result_relation_info = resultRelInfo;
/* /*
* Set up a ModifyTableState so we can let FDW(s) init themselves for * Set up a ModifyTableState so we can let FDW(s) init themselves for
* foreign-table result relation(s). * foreign-table result relation(s).
...@@ -3108,11 +3104,6 @@ CopyFrom(CopyState cstate) ...@@ -3108,11 +3104,6 @@ CopyFrom(CopyState cstate)
prevResultRelInfo = resultRelInfo; prevResultRelInfo = resultRelInfo;
} }
/*
* For ExecInsertIndexTuples() to work on the partition's indexes
*/
estate->es_result_relation_info = resultRelInfo;
/* /*
* If we're capturing transition tuples, we might need to convert * If we're capturing transition tuples, we might need to convert
* from the partition rowtype to root rowtype. * from the partition rowtype to root rowtype.
...@@ -3217,7 +3208,8 @@ CopyFrom(CopyState cstate) ...@@ -3217,7 +3208,8 @@ CopyFrom(CopyState cstate)
/* Compute stored generated columns */ /* Compute stored generated columns */
if (resultRelInfo->ri_RelationDesc->rd_att->constr && if (resultRelInfo->ri_RelationDesc->rd_att->constr &&
resultRelInfo->ri_RelationDesc->rd_att->constr->has_generated_stored) resultRelInfo->ri_RelationDesc->rd_att->constr->has_generated_stored)
ExecComputeStoredGenerated(estate, myslot, CMD_INSERT); ExecComputeStoredGenerated(resultRelInfo, estate, myslot,
CMD_INSERT);
/* /*
* If the target is a plain table, check the constraints of * If the target is a plain table, check the constraints of
...@@ -3288,7 +3280,8 @@ CopyFrom(CopyState cstate) ...@@ -3288,7 +3280,8 @@ CopyFrom(CopyState cstate)
myslot, mycid, ti_options, bistate); myslot, mycid, ti_options, bistate);
if (resultRelInfo->ri_NumIndices > 0) if (resultRelInfo->ri_NumIndices > 0)
recheckIndexes = ExecInsertIndexTuples(myslot, recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
myslot,
estate, estate,
false, false,
NULL, NULL,
......
...@@ -1820,7 +1820,6 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, ...@@ -1820,7 +1820,6 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
resultRelInfo = resultRelInfos; resultRelInfo = resultRelInfos;
foreach(cell, rels) foreach(cell, rels)
{ {
estate->es_result_relation_info = resultRelInfo;
ExecBSTruncateTriggers(estate, resultRelInfo); ExecBSTruncateTriggers(estate, resultRelInfo);
resultRelInfo++; resultRelInfo++;
} }
...@@ -1950,7 +1949,6 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged, ...@@ -1950,7 +1949,6 @@ ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
resultRelInfo = resultRelInfos; resultRelInfo = resultRelInfos;
foreach(cell, rels) foreach(cell, rels)
{ {
estate->es_result_relation_info = resultRelInfo;
ExecASTruncateTriggers(estate, resultRelInfo); ExecASTruncateTriggers(estate, resultRelInfo);
resultRelInfo++; resultRelInfo++;
} }
......
...@@ -270,7 +270,8 @@ ExecCloseIndices(ResultRelInfo *resultRelInfo) ...@@ -270,7 +270,8 @@ ExecCloseIndices(ResultRelInfo *resultRelInfo)
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
List * List *
ExecInsertIndexTuples(TupleTableSlot *slot, ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot,
EState *estate, EState *estate,
bool noDupErr, bool noDupErr,
bool *specConflict, bool *specConflict,
...@@ -278,7 +279,6 @@ ExecInsertIndexTuples(TupleTableSlot *slot, ...@@ -278,7 +279,6 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
{ {
ItemPointer tupleid = &slot->tts_tid; ItemPointer tupleid = &slot->tts_tid;
List *result = NIL; List *result = NIL;
ResultRelInfo *resultRelInfo;
int i; int i;
int numIndices; int numIndices;
RelationPtr relationDescs; RelationPtr relationDescs;
...@@ -293,7 +293,6 @@ ExecInsertIndexTuples(TupleTableSlot *slot, ...@@ -293,7 +293,6 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
/* /*
* Get information from the result relation info structure. * Get information from the result relation info structure.
*/ */
resultRelInfo = estate->es_result_relation_info;
numIndices = resultRelInfo->ri_NumIndices; numIndices = resultRelInfo->ri_NumIndices;
relationDescs = resultRelInfo->ri_IndexRelationDescs; relationDescs = resultRelInfo->ri_IndexRelationDescs;
indexInfoArray = resultRelInfo->ri_IndexRelationInfo; indexInfoArray = resultRelInfo->ri_IndexRelationInfo;
...@@ -479,11 +478,10 @@ ExecInsertIndexTuples(TupleTableSlot *slot, ...@@ -479,11 +478,10 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
bool bool
ExecCheckIndexConstraints(TupleTableSlot *slot, ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot,
EState *estate, ItemPointer conflictTid, EState *estate, ItemPointer conflictTid,
List *arbiterIndexes) List *arbiterIndexes)
{ {
ResultRelInfo *resultRelInfo;
int i; int i;
int numIndices; int numIndices;
RelationPtr relationDescs; RelationPtr relationDescs;
...@@ -501,7 +499,6 @@ ExecCheckIndexConstraints(TupleTableSlot *slot, ...@@ -501,7 +499,6 @@ ExecCheckIndexConstraints(TupleTableSlot *slot,
/* /*
* Get information from the result relation info structure. * Get information from the result relation info structure.
*/ */
resultRelInfo = estate->es_result_relation_info;
numIndices = resultRelInfo->ri_NumIndices; numIndices = resultRelInfo->ri_NumIndices;
relationDescs = resultRelInfo->ri_IndexRelationDescs; relationDescs = resultRelInfo->ri_IndexRelationDescs;
indexInfoArray = resultRelInfo->ri_IndexRelationInfo; indexInfoArray = resultRelInfo->ri_IndexRelationInfo;
......
...@@ -827,9 +827,6 @@ InitPlan(QueryDesc *queryDesc, int eflags) ...@@ -827,9 +827,6 @@ InitPlan(QueryDesc *queryDesc, int eflags)
estate->es_plannedstmt = plannedstmt; estate->es_plannedstmt = plannedstmt;
/* es_result_relation_info is NULL except when within ModifyTable */
estate->es_result_relation_info = NULL;
/* /*
* Next, build the ExecRowMark array from the PlanRowMark(s), if any. * Next, build the ExecRowMark array from the PlanRowMark(s), if any.
*/ */
...@@ -2694,7 +2691,6 @@ EvalPlanQualStart(EPQState *epqstate, Plan *planTree) ...@@ -2694,7 +2691,6 @@ EvalPlanQualStart(EPQState *epqstate, Plan *planTree)
* subplans themselves are initialized. * subplans themselves are initialized.
*/ */
parentestate->es_result_relations = NULL; parentestate->es_result_relations = NULL;
/* es_result_relation_info must NOT be copied */
/* es_trig_target_relations must NOT be copied */ /* es_trig_target_relations must NOT be copied */
rcestate->es_top_eflags = parentestate->es_top_eflags; rcestate->es_top_eflags = parentestate->es_top_eflags;
rcestate->es_instrument = parentestate->es_instrument; rcestate->es_instrument = parentestate->es_instrument;
......
...@@ -404,10 +404,10 @@ retry: ...@@ -404,10 +404,10 @@ retry:
* Caller is responsible for opening the indexes. * Caller is responsible for opening the indexes.
*/ */
void void
ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot) ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo,
EState *estate, TupleTableSlot *slot)
{ {
bool skip_tuple = false; bool skip_tuple = false;
ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
Relation rel = resultRelInfo->ri_RelationDesc; Relation rel = resultRelInfo->ri_RelationDesc;
/* For now we support only tables. */ /* For now we support only tables. */
...@@ -430,7 +430,8 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot) ...@@ -430,7 +430,8 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
/* Compute stored generated columns */ /* Compute stored generated columns */
if (rel->rd_att->constr && if (rel->rd_att->constr &&
rel->rd_att->constr->has_generated_stored) rel->rd_att->constr->has_generated_stored)
ExecComputeStoredGenerated(estate, slot, CMD_INSERT); ExecComputeStoredGenerated(resultRelInfo, estate, slot,
CMD_INSERT);
/* Check the constraints of the tuple */ /* Check the constraints of the tuple */
if (rel->rd_att->constr) if (rel->rd_att->constr)
...@@ -442,7 +443,8 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot) ...@@ -442,7 +443,8 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
simple_table_tuple_insert(resultRelInfo->ri_RelationDesc, slot); simple_table_tuple_insert(resultRelInfo->ri_RelationDesc, slot);
if (resultRelInfo->ri_NumIndices > 0) if (resultRelInfo->ri_NumIndices > 0)
recheckIndexes = ExecInsertIndexTuples(slot, estate, false, NULL, recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
slot, estate, false, NULL,
NIL); NIL);
/* AFTER ROW INSERT Triggers */ /* AFTER ROW INSERT Triggers */
...@@ -466,11 +468,11 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot) ...@@ -466,11 +468,11 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot)
* Caller is responsible for opening the indexes. * Caller is responsible for opening the indexes.
*/ */
void void
ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo,
EState *estate, EPQState *epqstate,
TupleTableSlot *searchslot, TupleTableSlot *slot) TupleTableSlot *searchslot, TupleTableSlot *slot)
{ {
bool skip_tuple = false; bool skip_tuple = false;
ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
Relation rel = resultRelInfo->ri_RelationDesc; Relation rel = resultRelInfo->ri_RelationDesc;
ItemPointer tid = &(searchslot->tts_tid); ItemPointer tid = &(searchslot->tts_tid);
...@@ -496,7 +498,8 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, ...@@ -496,7 +498,8 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
/* Compute stored generated columns */ /* Compute stored generated columns */
if (rel->rd_att->constr && if (rel->rd_att->constr &&
rel->rd_att->constr->has_generated_stored) rel->rd_att->constr->has_generated_stored)
ExecComputeStoredGenerated(estate, slot, CMD_UPDATE); ExecComputeStoredGenerated(resultRelInfo, estate, slot,
CMD_UPDATE);
/* Check the constraints of the tuple */ /* Check the constraints of the tuple */
if (rel->rd_att->constr) if (rel->rd_att->constr)
...@@ -508,7 +511,8 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, ...@@ -508,7 +511,8 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
&update_indexes); &update_indexes);
if (resultRelInfo->ri_NumIndices > 0 && update_indexes) if (resultRelInfo->ri_NumIndices > 0 && update_indexes)
recheckIndexes = ExecInsertIndexTuples(slot, estate, false, NULL, recheckIndexes = ExecInsertIndexTuples(resultRelInfo,
slot, estate, false, NULL,
NIL); NIL);
/* AFTER ROW UPDATE Triggers */ /* AFTER ROW UPDATE Triggers */
...@@ -527,11 +531,11 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, ...@@ -527,11 +531,11 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate,
* Caller is responsible for opening the indexes. * Caller is responsible for opening the indexes.
*/ */
void void
ExecSimpleRelationDelete(EState *estate, EPQState *epqstate, ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo,
EState *estate, EPQState *epqstate,
TupleTableSlot *searchslot) TupleTableSlot *searchslot)
{ {
bool skip_tuple = false; bool skip_tuple = false;
ResultRelInfo *resultRelInfo = estate->es_result_relation_info;
Relation rel = resultRelInfo->ri_RelationDesc; Relation rel = resultRelInfo->ri_RelationDesc;
ItemPointer tid = &searchslot->tts_tid; ItemPointer tid = &searchslot->tts_tid;
......
...@@ -125,7 +125,6 @@ CreateExecutorState(void) ...@@ -125,7 +125,6 @@ CreateExecutorState(void)
estate->es_result_relations = NULL; estate->es_result_relations = NULL;
estate->es_opened_result_relations = NIL; estate->es_opened_result_relations = NIL;
estate->es_result_relation_info = NULL;
estate->es_tuple_routing_result_relations = NIL; estate->es_tuple_routing_result_relations = NIL;
estate->es_trig_target_relations = NIL; estate->es_trig_target_relations = NIL;
......
This diff is collapsed.
...@@ -1174,7 +1174,6 @@ apply_handle_insert(StringInfo s) ...@@ -1174,7 +1174,6 @@ apply_handle_insert(StringInfo s)
&TTSOpsVirtual); &TTSOpsVirtual);
resultRelInfo = makeNode(ResultRelInfo); resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0); InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0);
estate->es_result_relation_info = resultRelInfo;
/* Input functions may need an active snapshot, so get one */ /* Input functions may need an active snapshot, so get one */
PushActiveSnapshot(GetTransactionSnapshot()); PushActiveSnapshot(GetTransactionSnapshot());
...@@ -1214,7 +1213,7 @@ apply_handle_insert_internal(ResultRelInfo *relinfo, ...@@ -1214,7 +1213,7 @@ apply_handle_insert_internal(ResultRelInfo *relinfo,
ExecOpenIndices(relinfo, false); ExecOpenIndices(relinfo, false);
/* Do the insert. */ /* Do the insert. */
ExecSimpleRelationInsert(estate, remoteslot); ExecSimpleRelationInsert(relinfo, estate, remoteslot);
/* Cleanup. */ /* Cleanup. */
ExecCloseIndices(relinfo); ExecCloseIndices(relinfo);
...@@ -1300,7 +1299,6 @@ apply_handle_update(StringInfo s) ...@@ -1300,7 +1299,6 @@ apply_handle_update(StringInfo s)
&TTSOpsVirtual); &TTSOpsVirtual);
resultRelInfo = makeNode(ResultRelInfo); resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0); InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0);
estate->es_result_relation_info = resultRelInfo;
/* /*
* Populate updatedCols so that per-column triggers can fire. This could * Populate updatedCols so that per-column triggers can fire. This could
...@@ -1392,7 +1390,8 @@ apply_handle_update_internal(ResultRelInfo *relinfo, ...@@ -1392,7 +1390,8 @@ apply_handle_update_internal(ResultRelInfo *relinfo,
EvalPlanQualSetSlot(&epqstate, remoteslot); EvalPlanQualSetSlot(&epqstate, remoteslot);
/* Do the actual update. */ /* Do the actual update. */
ExecSimpleRelationUpdate(estate, &epqstate, localslot, remoteslot); ExecSimpleRelationUpdate(relinfo, estate, &epqstate, localslot,
remoteslot);
} }
else else
{ {
...@@ -1455,7 +1454,6 @@ apply_handle_delete(StringInfo s) ...@@ -1455,7 +1454,6 @@ apply_handle_delete(StringInfo s)
&TTSOpsVirtual); &TTSOpsVirtual);
resultRelInfo = makeNode(ResultRelInfo); resultRelInfo = makeNode(ResultRelInfo);
InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0); InitResultRelInfo(resultRelInfo, rel->localrel, 1, NULL, 0);
estate->es_result_relation_info = resultRelInfo;
PushActiveSnapshot(GetTransactionSnapshot()); PushActiveSnapshot(GetTransactionSnapshot());
...@@ -1508,7 +1506,7 @@ apply_handle_delete_internal(ResultRelInfo *relinfo, EState *estate, ...@@ -1508,7 +1506,7 @@ apply_handle_delete_internal(ResultRelInfo *relinfo, EState *estate,
EvalPlanQualSetSlot(&epqstate, localslot); EvalPlanQualSetSlot(&epqstate, localslot);
/* Do the actual delete. */ /* Do the actual delete. */
ExecSimpleRelationDelete(estate, &epqstate, localslot); ExecSimpleRelationDelete(relinfo, estate, &epqstate, localslot);
} }
else else
{ {
...@@ -1616,7 +1614,6 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo, ...@@ -1616,7 +1614,6 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo,
} }
MemoryContextSwitchTo(oldctx); MemoryContextSwitchTo(oldctx);
estate->es_result_relation_info = partrelinfo;
switch (operation) switch (operation)
{ {
case CMD_INSERT: case CMD_INSERT:
...@@ -1697,8 +1694,8 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo, ...@@ -1697,8 +1694,8 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo,
ExecOpenIndices(partrelinfo, false); ExecOpenIndices(partrelinfo, false);
EvalPlanQualSetSlot(&epqstate, remoteslot_part); EvalPlanQualSetSlot(&epqstate, remoteslot_part);
ExecSimpleRelationUpdate(estate, &epqstate, localslot, ExecSimpleRelationUpdate(partrelinfo, estate, &epqstate,
remoteslot_part); localslot, remoteslot_part);
ExecCloseIndices(partrelinfo); ExecCloseIndices(partrelinfo);
EvalPlanQualEnd(&epqstate); EvalPlanQualEnd(&epqstate);
} }
...@@ -1739,7 +1736,6 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo, ...@@ -1739,7 +1736,6 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo,
Assert(partrelinfo_new != partrelinfo); Assert(partrelinfo_new != partrelinfo);
/* DELETE old tuple found in the old partition. */ /* DELETE old tuple found in the old partition. */
estate->es_result_relation_info = partrelinfo;
apply_handle_delete_internal(partrelinfo, estate, apply_handle_delete_internal(partrelinfo, estate,
localslot, localslot,
&relmapentry->remoterel); &relmapentry->remoterel);
...@@ -1771,7 +1767,6 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo, ...@@ -1771,7 +1767,6 @@ apply_handle_tuple_routing(ResultRelInfo *relinfo,
slot_getallattrs(remoteslot); slot_getallattrs(remoteslot);
} }
MemoryContextSwitchTo(oldctx); MemoryContextSwitchTo(oldctx);
estate->es_result_relation_info = partrelinfo_new;
apply_handle_insert_internal(partrelinfo_new, estate, apply_handle_insert_internal(partrelinfo_new, estate,
remoteslot_part); remoteslot_part);
} }
......
...@@ -576,10 +576,14 @@ extern TupleTableSlot *ExecGetReturningSlot(EState *estate, ResultRelInfo *relIn ...@@ -576,10 +576,14 @@ extern TupleTableSlot *ExecGetReturningSlot(EState *estate, ResultRelInfo *relIn
*/ */
extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative); extern void ExecOpenIndices(ResultRelInfo *resultRelInfo, bool speculative);
extern void ExecCloseIndices(ResultRelInfo *resultRelInfo); extern void ExecCloseIndices(ResultRelInfo *resultRelInfo);
extern List *ExecInsertIndexTuples(TupleTableSlot *slot, EState *estate, bool noDupErr, extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, EState *estate,
bool noDupErr,
bool *specConflict, List *arbiterIndexes); bool *specConflict, List *arbiterIndexes);
extern bool ExecCheckIndexConstraints(TupleTableSlot *slot, EState *estate, extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo,
ItemPointer conflictTid, List *arbiterIndexes); TupleTableSlot *slot,
EState *estate, ItemPointer conflictTid,
List *arbiterIndexes);
extern void check_exclusion_constraint(Relation heap, Relation index, extern void check_exclusion_constraint(Relation heap, Relation index,
IndexInfo *indexInfo, IndexInfo *indexInfo,
ItemPointer tupleid, ItemPointer tupleid,
...@@ -596,10 +600,13 @@ extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid, ...@@ -596,10 +600,13 @@ extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode, extern bool RelationFindReplTupleSeq(Relation rel, LockTupleMode lockmode,
TupleTableSlot *searchslot, TupleTableSlot *outslot); TupleTableSlot *searchslot, TupleTableSlot *outslot);
extern void ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot); extern void ExecSimpleRelationInsert(ResultRelInfo *resultRelInfo,
extern void ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, EState *estate, TupleTableSlot *slot);
extern void ExecSimpleRelationUpdate(ResultRelInfo *resultRelInfo,
EState *estate, EPQState *epqstate,
TupleTableSlot *searchslot, TupleTableSlot *slot); TupleTableSlot *searchslot, TupleTableSlot *slot);
extern void ExecSimpleRelationDelete(EState *estate, EPQState *epqstate, extern void ExecSimpleRelationDelete(ResultRelInfo *resultRelInfo,
EState *estate, EPQState *epqstate,
TupleTableSlot *searchslot); TupleTableSlot *searchslot);
extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd); extern void CheckCmdReplicaIdentity(Relation rel, CmdType cmd);
......
...@@ -15,7 +15,9 @@ ...@@ -15,7 +15,9 @@
#include "nodes/execnodes.h" #include "nodes/execnodes.h"
extern void ExecComputeStoredGenerated(EState *estate, TupleTableSlot *slot, CmdType cmdtype); extern void ExecComputeStoredGenerated(ResultRelInfo *resultRelInfo,
EState *estate, TupleTableSlot *slot,
CmdType cmdtype);
extern ModifyTableState *ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags); extern ModifyTableState *ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags);
extern void ExecEndModifyTable(ModifyTableState *node); extern void ExecEndModifyTable(ModifyTableState *node);
......
...@@ -525,7 +525,6 @@ typedef struct EState ...@@ -525,7 +525,6 @@ typedef struct EState
List *es_opened_result_relations; /* List of non-NULL entries in List *es_opened_result_relations; /* List of non-NULL entries in
* es_result_relations in no * es_result_relations in no
* specific order */ * specific order */
ResultRelInfo *es_result_relation_info; /* currently active array elt */
PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */ PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */
......
...@@ -818,9 +818,7 @@ drop role regress_coldesc_role; ...@@ -818,9 +818,7 @@ drop role regress_coldesc_role;
drop table inserttest3; drop table inserttest3;
drop table brtrigpartcon; drop table brtrigpartcon;
drop function brtrigpartcon1trigf(); drop function brtrigpartcon1trigf();
-- check that "do nothing" BR triggers work with tuple-routing (this checks -- check that "do nothing" BR triggers work with tuple-routing
-- that estate->es_result_relation_info is appropriately set/reset for each
-- routed tuple)
create table donothingbrtrig_test (a int, b text) partition by list (a); create table donothingbrtrig_test (a int, b text) partition by list (a);
create table donothingbrtrig_test1 (b text, a int); create table donothingbrtrig_test1 (b text, a int);
create table donothingbrtrig_test2 (c text, b text, a int); create table donothingbrtrig_test2 (c text, b text, a int);
......
...@@ -542,9 +542,7 @@ drop table inserttest3; ...@@ -542,9 +542,7 @@ drop table inserttest3;
drop table brtrigpartcon; drop table brtrigpartcon;
drop function brtrigpartcon1trigf(); drop function brtrigpartcon1trigf();
-- check that "do nothing" BR triggers work with tuple-routing (this checks -- check that "do nothing" BR triggers work with tuple-routing
-- that estate->es_result_relation_info is appropriately set/reset for each
-- routed tuple)
create table donothingbrtrig_test (a int, b text) partition by list (a); create table donothingbrtrig_test (a int, b text) partition by list (a);
create table donothingbrtrig_test1 (b text, a int); create table donothingbrtrig_test1 (b text, a int);
create table donothingbrtrig_test2 (c text, b text, a int); create table donothingbrtrig_test2 (c text, b text, a int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment